Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT shorter version of OR conditional statement

Tags:

xslt

I was wondering if someone remembers how to write a shorter OR statements in XSLT. I'm sure there was a way but I can't remember.

So instead of

test="$var = 'text1' or $var = 'text2'"

I'd like to use a shorter version like test="$var =['text1','text2']" However, I can't remember or find the right shorthand syntax for such cases.

Would really appreciate if someone could help with that!

Many thanks

like image 766
DashaLuna Avatar asked Dec 14 '25 12:12

DashaLuna


1 Answers

With XSLT 2.0 (but not with XSLT 1.0) you can do

<xsl:if test="$var = ('text1','text2')">

Maybe that is the syntax you are looking for.

like image 74
Martin Honnen Avatar answered Dec 16 '25 23:12

Martin Honnen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!