D
Dimitre Novatchev
The following expression was rejected by Xalan:
The value of $pos will always be 1 because the node-set specified as
the value of the "select" attribute of the above xsl:for-each consists
of a single element.
Therefore Xalan (and any XPath engine) will evaluate:
to the empty node-set, because position() cannot be less than one
(e.g. 0 or negative).
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
*[position() < $pos]
Where 'pos' is an XSL variable having a numerical value. What is wrong
here and in comparable expressions like:
*[$pos > position()]
or
*[position() < $pos]
which Xalan is also unable to interpret? And if for some reason this
is not legal XPath (though I couldn't find such a reason in the spec),
how can I specify child elements preceding an element with a specific
position?
Btw, 'pos' was created as follows:
<xsl:variable name="pos">
<xsl:for-each select="*[generate-id(.)=$id]">
<xsl:value select="position()"/>
</xsl:for-each>
</xsl:variable>
The value of $pos will always be 1 because the node-set specified as
the value of the "select" attribute of the above xsl:for-each consists
of a single element.
Therefore Xalan (and any XPath engine) will evaluate:
*[position() < $pos]
to the empty node-set, because position() cannot be less than one
(e.g. 0 or negative).
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL