Is there any way to put more then one value in the right part of equation?
<xsl:choose>
<xsl:when test="Properties/LabeledProperty[Label='Category Code']/Value = 600,605,610">
This code above returns:
XPath error : Invalid expression
Properties/LabeledProperty[Label='Category Code']/Value = 600,605,610
^
compilation error: file adsml2adpay.xsl line 107 element when
The reason I don’t want to use ‘OR’ is because there are around 20 numbers should be in the right part for each ‘when’ test.
This works because the XPath
=operator compares every node from the left hand side to every node on the right hand side when working on node sets (comparable to an SQLINNER JOIN).Hence all you need to do is create a node set from your individual values. Using a temporary namespace you can do that right in your XSLT file.
Also note that I’ve introduced an
<xsl:key>to make selecting property values by their label more efficient.EDIT: You could also create an external
config.xmlfile and do this:With XSLT 2.0 the concept of sequences has been added. It’s simpler to do the same thing there:
This means you could easily pass in the string
'600,605,610'as an external parameter.