Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#292 xsl:number executed outside for-each

v8.2
closed
Michael Kay
5
2012-10-08
2005-01-18
Michael Kay
No

Saxon's optimizer fails to recognize that the result of
xsl:number typically depends on the context node; as a
result, a call on xsl:number may be incorrectly moved
out of a for-each loop, causing incorrect output.

Source fix: in net.sf.saxon.instruct.NumberInstruction

(1) In method iteratorSubExpressions (line 210), change
the start of the method to read:

public Iterator iterateSubExpressions() {
    List sub = new ArrayList(9);
    if (select != null) {
        sub.add(select);
    }
    if (value != null) {
        sub.add(value);
    }

(2) Add the method:

public int getIntrinsicDependencies() {
    return (select == null ?

StaticProperty.DEPENDS_ON_CONTEXT_ITEM : 0);
}

Discussion