Improve "IfThenElse"
- Dominant language
- Rust
- Stars
- 114
- Forks
- 85
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 42
Description
I added the function `IfThenElse` to the rules that can be used. It should evaluate the condition, and then evaluate the "then" _or_ "else" parts. However, both the "then" _and_ "else" parts are being evaluated.
This happens because of the way sxd_xpath works:
```
impl Function for IfThenElse {
fn evaluate<'d>(&self,
_context: &context::Evaluation<'_, 'd>,
args: Vec>)
-> Result, Error>
{
```
The `args` above are the if/then/else and they are all evaluated before this function definition kicks in.
On potential solution is that in a rule that builds anything with an "IfThenElse" in it, it quotes the 'then' and 'else' parts and has the above code evaluate whichever one is appropriate.
I'm not sure whether it is possible to find all the "IfThenElse"s and make the then/else parts strings. It appears that nearly all uses are part of a variable definition, so any efforts should be focused on `VariableDefinition::build`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.