There appears to be an incorrect optimization happening here for the expression $seq[position() > D] where D is a double (or float or decimal) that is equal to an integer. I'll look into it.
 
Meanwhile, as you pointed out in an off-list email, you can work around this by rewriting the expressions to use the idiv operator.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Arthur Naylor
Sent: 04 April 2008 23:22
To: saxon-help@lists.sourceforge.net
Subject: [saxon] COUNT and POSITION in XSLT 2.0

I am using the attached XML and XSL ... which work fine under XSLT 1.0 but which give odd results under 2.0�

the issue concerns the following ...�


�� � � � � � � �<div class="columns">�� � � � � � � � � ��� � � � � � � � � �<xsl:apply-templates select="//videos" mode="entries"/>�� � � � � � � � � �<xsl:apply-templates select="//audios" mode="entries"/>�� � � � � � � � � ��� � � � � � � � � �<xsl:apply-templates select=" //subcategories/subcategory[position() &lt; ceiling(count(//subcategories/subcategory) div 2) + 1]"�� � � � � � � � � �/>�� � � � � � � � � ��� � � � � � � � � �<xsl:apply-templates select="//authors" mode="entries"/>�� � � � � � � � � ��� � � � � � � �</div>�� � � � � �</td>�� � � � � �<td class="delimiter" width="1"></td>�� � � � � �<td class="columns middle">�� � � � � � � �<div class="columns">�� � � � � � � � � ��� � � � � � � � � �<xsl:apply-templates select="//galleries" mode="entries"/>�� � � � � � � � � ��� � � � � � � � � �<xsl:apply-templates select=" //subcategories/subcategory[position() &gt; ceiling(count(//subcategories/subcategory) div 2)]"�� � � � � � � � � �/>�� � � � � � � � � ��� � � � � � � �</div>

which transforms the first half of the //subcategories/subcategory nodes in one area and then the second half in another ...�

under XSLT 1.0 the results are as expected ... half the nodes are transformed in the first area and the other half in the second ...�

but under XSLT 2.0 some of the nodes from the first half are included with the second half of the nodes ...�

attached are the dynamically generated XML and the XSL file (missing imported stylesheets)�

thank you�for any suggestions�

arthur�