| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.event; |
| 9 | |
| 10 | import net.sf.saxon.expr.parser.Location; |
| 11 | import net.sf.saxon.om.Item; |
| 12 | import net.sf.saxon.trans.XPathException; |
| 13 | |
| 14 | /** |
| 15 | * Implement the "sequence normalization" logic as defined in the XSLT 3.0/XQuery 3.0 |
| 16 | * serialization spec, for the case where there is no item-separator. |
| 17 | * |
| 18 | * <p>This class is used only if no ItemSeparator is specified. Its effect is to insert |
| 19 | * a single space as a separator between adjacent atomic values appearing in the top level |
| 20 | * sequence.</p> |
| 21 | */ |
| 22 | |
| 23 | public class SequenceNormalizerWithSpaceSeparator extends SequenceNormalizer { |
| 24 | |
| 25 | public SequenceNormalizerWithSpaceSeparator(Receiver next) { |
| 26 | super(next); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Append an arbitrary item (node or atomic value) to the output |
| 31 | * |
| 32 | * @param item the item to be appended |
| 33 | * @param locationId the location of the calling instruction, for diagnostics |
| 34 | * @param copyNamespaces if the item is an element node, this indicates whether its namespaces |
| 35 | * need to be copied. Values are {@link ReceiverOptions#ALL_NAMESPACES}, |
| 36 | * {@link ReceiverOptions#LOCAL_NAMESPACES}; the default (0) means |
| 37 | * no namespaces |
| 38 | */ |
| 39 | @Override |
| 40 | public void append(Item item, Location locationId, int copyNamespaces) throws XPathException { |
| 41 | decompose(item, locationId, copyNamespaces); |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | protected String getErrorCodeForDecomposingFunctionItems() { |
| 46 | return "SENR0001"; |
| 47 | } |
| 48 | } |
| 49 |