Project

Profile

Help

Revision 7148a768

Added by Michael Kay 10 months ago

Fix bug #4786

View differences:

latest10/hej/net/sf/saxon/expr/accum/AccumulatorData.java
22 22
import net.sf.saxon.trans.rules.Rule;
23 23
import net.sf.saxon.tree.iter.ManualIterator;
24 24
import net.sf.saxon.tree.util.Navigator;
25
import net.sf.saxon.type.Type;
25 26

  
26 27
import java.util.ArrayList;
27 28
import java.util.List;
......
164 165
        c2.setTemporaryOutputState(StandardNames.XSL_ACCUMULATOR_RULE);
165 166
        value = Evaluator.EAGER_SEQUENCE.evaluate(delta, c2);
166 167
        //System.err.println("Node " + ((TinyNodeImpl) node).getNodeNumber() + " : " + value);
168
        if (node.getNodeKind() == Type.DOCUMENT && !isPostDescent && values.size() == 1) {
169
            // Overwrite the accumulator's initial value with the "before document start" value. Bug 4786.
170
            values.clear();
171
        }
167 172
        values.add(new DataPoint(new Visit(node, isPostDescent), value));
168 173
        return value;
169 174
    }
latest9.9/hej/net/sf/saxon/expr/accum/AccumulatorData.java
20 20
import net.sf.saxon.tree.iter.AxisIterator;
21 21
import net.sf.saxon.tree.iter.ManualIterator;
22 22
import net.sf.saxon.tree.util.Navigator;
23
import net.sf.saxon.type.Type;
23 24

  
24 25
import java.util.ArrayList;
25 26
import java.util.List;
......
153 154
        c2.setTemporaryOutputState(StandardNames.XSL_ACCUMULATOR_RULE);
154 155
        value = Evaluator.EAGER_SEQUENCE.evaluate(delta, c2);
155 156
        //System.err.println("Node " + ((TinyNodeImpl) node).getNodeNumber() + " : " + value);
157
        if (node.getNodeKind() == Type.DOCUMENT && !isPostDescent && values.size() == 1) {
158
            // Overwrite the accumulator's initial value with the "before document start" value. Bug 4786.
159
            values.clear();
160
        }
156 161
        values.add(new DataPoint(new Visit(node, isPostDescent), value));
157 162
        return value;
158 163
    }

Also available in: Unified diff