I want to declare 2-3 variables using a function let
and run a separate loop for
for each variable. How can i do this?
I can use only XPath 3.0.
Thanks in advance.
I tried expressions like this, but they don't work:
1)
let $x := a, $y := b return (for $var1 in $x return expr1), (for $var2 in $y return expr2)
return (for $var1 in $x return expr1, for $var2 in $y return expr2)
return for $var1 in $x return expr1, for $var2 in $y return expr2
The syntax in XPath 3.0 is
[11] LetExpr ::=
SimpleLetClause "return" ExprSingle
[12] SimpleLetClause ::=
"let" SimpleLetBinding ("," SimpleLetBinding)*
[13] SimpleLetBinding ::=
"$" VarName ":=" ExprSingle
I believe that the construct:
let $x := a, $y := b
return (for $var1 in $x return expr1, for $var2 in $y return expr2)
should work, though I don't have an XPath 3.0 processor to try it on. It's certainly working in XPath 3.1.