#362 xsl:number count="x[1]"

v8.4
closed
Michael Kay
5
2012-10-08
2005-05-30
Michael Kay
No

If a pattern containing the predicate [1] or [last()]
is used in an instruction (that is, in the count or
from attributes of xsl:number or the
group-starting-with or group-ending-with attributes of
xsl:for-each-group) then the predicate is ignored when
testing whether nodes match the pattern.

The bug was introduced in Saxon 8.3. Test case numbering66.

Source fix:

In net.sf.saxon.pattern.LocationPathPattern, method
simplify() at line 62, change the test

if ( parentPattern == null &&
ancestorPattern == null &&
filters == null) {

to

if ( parentPattern == null &&
ancestorPattern == null &&
filters == null &&
!firstElementPattern &&
!lastElementPattern) {

Michael Kay

Discussion