I have code like this:
<xsl:if test="$k='7' or $k = '8' or $k = '9'">
Is there any way to put this expression in a form, like, for instance SQL
k IN (7, 8, 9)
Ty :)
I have code like this:
<xsl:if test="$k='7' or $k = '8' or $k = '9'">
Is there any way to put this expression in a form, like, for instance SQL
k IN (7, 8, 9)
Ty :)
XSLT / XPath 1.0:
You can use other separators if needed.
In XSLT / XPath 2.0 you could do something like:
If you can use document structure to define your list, you could do:
If your processor supports XPath 2.0, then you can compare
$k
to a sequence like so:You could even use the range-operator in this particular case:
There is no need for an explicit type cast. Tested with Saxon-HE 9.8.0.12N (XSLT 3.0).
Example XML:
Stylesheet:
Result: