Hi all,
XSL Novice
In the source XML I have a Display_Count node that is the
number of lines to display in the output HTML generated by
my XSL.
So for example, if <Display_Count>10</Display_Count> I get 10
lines, if <Display_Count>5</Display_Count> I get 5.
I set a variable loop_num to be used as a loop counter later
in the XSL as follows:
<xsl:variable name="loop_num" select="//Display_Count"/>
This works fine.
Now I want to handle the case where the Display_Count node
does not exist in the XML input. That is, I want to set a
default value (say, of 3) for loop_num in that case.
I ran into the problem where a variable cannot be reassigned
and its definition cannot be duplicated in the current scope.
So something like this will not work:
<xsl:choose>
<xsl:when test="not(//Display_Count)">
<xsl:variable name="loop_num" select="1"/>
</xsl:when>
<xsl

therwise>
<xsl:variable name="loop_num" select="//Display_Count"/>
</xsl

therwise>
</xsl:choose>
How can I set the varable loop_num to some default constant
value if the Display_Count node does not exist or to the value
of the Display_Count node if it does exist?
Thanks
kpg