mIchael wolff wrote:
Hello,
I am using Saxon 8.8 and and trying to set a variable
when a certain value is found in the node list.
Setting a variable is something not possible in XSLT.
When I walk through the code with XMLSpy debug, I see
that the variable never gets set. In fact, it skips
everything between the <xsl:variable> tags and goes
right to the line: <xsl:if test="not(Found)">
If you use XMLSpy Debug, you are not using Saxon anymore, but the
internal XMLSpy parser, which is likely to do things differently, more
so because it is still in the stages of adopting the xslt recommendation.
Does anyone know what is wrong with this template?
<xsl:variable name="Found">
<xsl:for-each select="current-group()">
<xsl:sort data-type="number" order="ascending"/>
You have a 'current-group()' here. But you do not have a
xsl:for-each-group instruction. The current-group function will return
the empty sequence when there is not xsl:for-each-group and as a result,
the xsl:for-each in your code has nothing to do, which results in the
empty sequence for the variable 'Found'.
The reason that the debugger does not step over it is probably because
XMLSpy has optimized it away. If you could step over it using Saxon, you
likely encountered the same behavior. For a processor, if it encounters
your code, regardless the input, '$Found' will contain the empty
sequence always.
As a consequence, your line with '<xsl:if test="not(Found)"> ' is the
first stop for the debugger (nothing else to do before that).
Cheers,
-- Abel Braaksma
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--