Project

Profile

Help

Revision 1cf81b44

Added by Michael Kay 5 months ago

Follow-up fixes for bugs #4786 and #4826.

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;
26 25

  
27 26
import java.util.ArrayList;
28 27
import java.util.List;
......
165 164
        c2.setTemporaryOutputState(StandardNames.XSL_ACCUMULATOR_RULE);
166 165
        value = Evaluator.EAGER_SEQUENCE.evaluate(delta, c2);
167 166
        //System.err.println("Node " + ((TinyNodeImpl) node).getNodeNumber() + " : " + value);
168
        if (node.getNodeKind() == Type.DOCUMENT && !isPostDescent && values.size() == 1) {
167
        if (node.getParent()==null && !isPostDescent && values.size() == 1) {
169 168
            // Overwrite the accumulator's initial value with the "before document start" value. Bug 4786.
170 169
            values.clear();
171 170
        }
latest10/hej/net/sf/saxon/serialize/JSONEmitter.java
257 257
            first = false;
258 258
        } else if (!afterKey) {
259 259
            emit(',');
260
            if (!actuallyIndenting) {
261
                emit(' ');
262
            }
263 260
        }
264 261
        if ((wasFirst && afterKey)) {
265 262
            emit(' ');
latest9.9/hej/net/sf/saxon/expr/accum/AccumulatorData.java
13 13
import net.sf.saxon.expr.XPathContextMajor;
14 14
import net.sf.saxon.expr.instruct.SlotManager;
15 15
import net.sf.saxon.expr.parser.Evaluator;
16
import net.sf.saxon.om.*;
16
import net.sf.saxon.om.AxisInfo;
17
import net.sf.saxon.om.NodeInfo;
18
import net.sf.saxon.om.Sequence;
19
import net.sf.saxon.om.StandardNames;
17 20
import net.sf.saxon.trans.Err;
18 21
import net.sf.saxon.trans.XPathException;
19 22
import net.sf.saxon.trans.rules.Rule;
20 23
import net.sf.saxon.tree.iter.AxisIterator;
21 24
import net.sf.saxon.tree.iter.ManualIterator;
22 25
import net.sf.saxon.tree.util.Navigator;
23
import net.sf.saxon.type.Type;
24 26

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

Also available in: Unified diff