Trying to combine an if statement using <xsl:if test="expression">
where I want to have multiple expressions together, to do order of operations such as this psuedocode:
if (Number != '' and (Name != '' or PreferredName != '')) {// code here}
Essentially I want to do this in an <xsl:if>
:
<xsl:if text="Number != '' and (Name != '' or PreferredName != '')">
but I'm not sure of the expression
syntax, I don't think I can do the ()
like that, as I haven't seen it anywhere. I couldn't find the expression syntax on the web easily, it may be XPath, but I'm not sure if XPath supports ()
to group expressions. I'm not an expert on XSL/XML/XSD's' so I don't know if the expression is even XPath, or what.
I'd rather not do nested <xsl:if>
statements if possible, and want to stick with <xsl:if>
not <xsl:choose>
.
I'm sure this is probably a simple answer, but kind of stuck here. Thanks.
The conditional statement xsl:if
for starters needs an xsl:template
or other xsl element as parent.
The syntax will become similar to the following:
<xsl:template>
... preliminary xsl statements ...
<xsl:if test="Number != '' and (Name != '' or PreferredName != '')">
... further xsl statements (the code you were referring to ...
</xsl:if>
... other xsl stataments ...
</xsl:template>
Further advise: study xslt usage, in particular templates and their application (and sort of automatic looping).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With