Donate Share

Saxon XSLT and XQuery Processor

Tracker: Bugs

5 position()!=last() in pattern fails - ID: 603928
Last Update: Settings changed ( mhkay )

A match pattern containing the predicate [position()!=last
()] or [position()<last()] gives the wrong answer: if
selects the nodes where position()=last(), and fails to
select those where position()!=last().

Applies to 6.5.2, 7.1, and 7.2.

Circumvention: declare a higher-priority template rule
with the pattern [position()=last()], and leave this filter off
the rule for matching other nodes.

Source fix (tested on Saxon 7.2):

(a) in expr.IsLastExpression, add the method

public boolean getCondition() {
return condition;
}

(b) in pattern.LocationPathPattern, around line 108 in
Saxon 7.2 or line 90 in Saxon 6.5.2, change the test:

if (nodeTest.getItemType() == Type.ELEMENT &&
numberOfFilters==1 &&
filters[0] instanceof IsLastExpression)

to:

if (nodeTest.getItemType() == Type.ELEMENT &&
numberOfFilters==1 &&
filters[0] instanceof IsLastExpression &&
((IsLastExpression)filters[0]).getCondition())

Source code fixed in both branches.

Test case added: pos64


Michael Kay ( mhkay ) - 2002-09-03 10:52

5

Closed

Fixed

Michael Kay

XSLT conformance

v6.5.2

Public


Comment ( 1 )

Date: 2002-11-18 14:04
Sender: mhkayProject Admin

Logged In: YES
user_id=251681

Cleared in 7.3


Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
status_id Open 2003-08-14 14:21 mhkay
resolution_id None 2003-08-14 14:21 mhkay
close_date - 2003-08-14 14:21 mhkay