xsl - multiple xsl:if with the same condition
Posted
by mickthomposn
on Stack Overflow
See other posts from Stack Overflow
or by mickthomposn
Published on 2010-06-11T10:38:58Z
Indexed on
2010/06/11
10:42 UTC
Read the original article
Hit count: 464
Newbie question on xslt. I've multiple xsl:if checks like
<xsl:if test="node/node1"> ...</xsl:if>
...
<xsl:if test="node/node1"> ...</xsl:if>
...
<xsl:if test="node/node1"> ... </xsl:if>
Is there a way to parameterize the test condition to make the code more readable and easy to maintain? Maybe with a variable or something like
<xsl:variable name="node1Present" select="true()"/>
<xsl:if test="$node1Present"> ... </xsl:if>
I don't understand how to construct the variable to reflect the 'test a node exist' (test="node/node1")
© Stack Overflow or respective owner