Class SaxonOutputKeys
- java.lang.Object
-
- net.sf.saxon.lib.SaxonOutputKeys
-
public class SaxonOutputKeys extends java.lang.Object
Provides string constants that can be used to set output properties for a Transformer, or to retrieve output properties from a Transformer or Templates object.These keys are private Saxon keys that supplement the standard keys defined in javax.xml.transform.OutputKeys. As well as Saxon extension attributes, the list includes new attributes defined in XSLT 2.0 which are not yet supported in JAXP
Note that for JAXP compatibility, the names of properties use Clark format, that is
{uri}local
. However, from 10.0, the values of properties containing QNames, such ascdata-section-elements
, use EQName format, that isQ{uri}local
.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALLOW_DUPLICATE_NAMES
allow-duplicate-names = yes|no.static java.lang.String
ATTRIBUTE_ORDER
saxon:attribute-order = list of attribute namesstatic java.lang.String
BUILD_TREE
build-tree = yes|no.static java.lang.String
BYTE_ORDER_MARK
byte-order-mark = yes|no.static java.lang.String
CANONICAL
saxon:canonical = yes/nostatic java.lang.String
CHARACTER_REPRESENTATION
representation = rep1[;rep2].static java.lang.String
DOUBLE_SPACE
saxon:double-space = list of element namesstatic java.lang.String
ESCAPE_URI_ATTRIBUTES
escape-uri-attributes = "yes" | "no".static java.lang.String
HTML_VERSION
html-version = decimalstatic java.lang.String
INCLUDE_CONTENT_TYPE
include-content-type = "yes" | "no".static java.lang.String
INDENT_SPACES
saxon:indent-spaces = integer.static java.lang.String
ITEM_SEPARATOR
item-separator = stringstatic java.lang.String
JSON_NODE_OUTPUT_METHOD
json-node-output-method = method-namestatic java.lang.String
LINE_LENGTH
saxon:line-length = integer.static java.lang.String
NEWLINE
saxon:newline = stringstatic java.lang.String
NEXT_IN_CHAIN
saxon:next-in-chain = URI.static java.lang.String
NEXT_IN_CHAIN_BASE_URI
static java.lang.String
NORMALIZATION_FORM
normalization-form = NFC|NFD|NFKC|NFKD|non.static java.lang.String
PARAMETER_DOCUMENT
parameter-document = URI.static java.lang.String
PARAMETER_DOCUMENT_BASE_URI
static java.lang.String
PROPERTY_ORDER
saxon:property-order = list of stringsstatic java.lang.String
RECOGNIZE_BINARY
recognize-binary = yes|no.static java.lang.String
REQUIRE_WELL_FORMED
saxon:require-well-formed = yes|no.static java.lang.String
SAXON_BASE64_BINARY_METHOD
String constant representing the saxon:base64Binary output method namestatic java.lang.String
SAXON_HEX_BINARY_METHOD
String constant representing the saxon:hexBinary output method namestatic java.lang.String
SAXON_XML_TO_JSON_METHOD
String constant representing the saxon:xml-to-json output method namestatic java.lang.String
SAXON_XQUERY_METHOD
String constant representing the saxon:xquery output method namestatic java.lang.String
SINGLE_QUOTES
saxon:single-quotes = boolean.static java.lang.String
STYLESHEET_VERSION
stylesheet-version.static java.lang.String
SUPPLY_SOURCE_LOCATOR
supply-source-locator = yes|no.static java.lang.String
SUPPRESS_INDENTATION
suppress-indentation = list of element namesstatic java.lang.String
UNDECLARE_PREFIXES
undeclare-prefixes = "yes" | "no".static java.lang.String
UNFAILING
Property saxon:unfailing used to indicate that serialization should not fail.static java.lang.String
USE_CHARACTER_MAPS
use-character-map = list-of-qnames.static java.lang.String
WRAP
wrap="yes"|"no".
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isBuildTree(java.util.Properties properties)
static boolean
isHtmlVersion5(java.util.Properties properties)
Examine the already-validated properties to see whether the html-version property is present with the decimal value 5.0, or if absent, the version property is present with the value 5.0.static boolean
isUnstrippedProperty(java.lang.String key)
Ask whether a particular serialization property is to be considered as string-valued, in which case the value is used exactly as specified without any whitespace stripping.static boolean
isXhtmlHtmlVersion5(java.util.Properties properties)
Examine the already-validated properties to see whether the html-version property is present with the decimal value 5.; used to decide whether to produce XHTML 5.0 in the XHTML output method.static java.lang.String
parseListOfNodeNames(java.lang.String value, NamespaceResolver nsResolver, boolean useDefaultNS, boolean prevalidated, boolean allowStar, java.lang.String errorCode)
Process a serialization property whose value is a list of element names, for example cdata-section-elements
-
-
-
Field Detail
-
SAXON_XQUERY_METHOD
public static final java.lang.String SAXON_XQUERY_METHOD
String constant representing the saxon:xquery output method name- See Also:
- Constant Field Values
-
SAXON_BASE64_BINARY_METHOD
public static final java.lang.String SAXON_BASE64_BINARY_METHOD
String constant representing the saxon:base64Binary output method name- See Also:
- Constant Field Values
-
SAXON_HEX_BINARY_METHOD
public static final java.lang.String SAXON_HEX_BINARY_METHOD
String constant representing the saxon:hexBinary output method name- See Also:
- Constant Field Values
-
SAXON_XML_TO_JSON_METHOD
public static final java.lang.String SAXON_XML_TO_JSON_METHOD
String constant representing the saxon:xml-to-json output method name- See Also:
- Constant Field Values
-
ALLOW_DUPLICATE_NAMES
public static final java.lang.String ALLOW_DUPLICATE_NAMES
allow-duplicate-names = yes|no.Defines whether duplicate keys are allowed in a JSON map (new in 3.1)
- See Also:
- Constant Field Values
-
BUILD_TREE
public static final java.lang.String BUILD_TREE
build-tree = yes|no.Defines whether the raw output is used to build an XML document tree
- See Also:
- Constant Field Values
-
INDENT_SPACES
public static final java.lang.String INDENT_SPACES
saxon:indent-spaces = integer.Defines the number of spaces used for indentation of output
- See Also:
- Constant Field Values
-
LINE_LENGTH
public static final java.lang.String LINE_LENGTH
saxon:line-length = integer.Defines the desired maximum line length used when indenting output
- See Also:
- Constant Field Values
-
SINGLE_QUOTES
public static final java.lang.String SINGLE_QUOTES
saxon:single-quotes = boolean.Indicates that attributes should be delimited by apostrophes rather than quotation marks
- See Also:
- Constant Field Values
-
SUPPRESS_INDENTATION
public static final java.lang.String SUPPRESS_INDENTATION
suppress-indentation = list of element namesDefines elements within which no indentation will occur
- See Also:
- Constant Field Values
-
HTML_VERSION
public static final java.lang.String HTML_VERSION
html-version = decimalDefines the version of HTML. For the XHTML output method this allows separate specification of the XHTML version and the XML version. This is a new serialization parameter in the draft 3.0 specification.
- See Also:
- Constant Field Values
-
ITEM_SEPARATOR
public static final java.lang.String ITEM_SEPARATOR
item-separator = stringRelevant to XQuery, where an arbitrary sequence can be serialized; defines a separator to be inserted between successive items in the sequence.
- See Also:
- Constant Field Values
-
JSON_NODE_OUTPUT_METHOD
public static final java.lang.String JSON_NODE_OUTPUT_METHOD
json-node-output-method = method-nameDefines the serialization method for nodes encountered while serializing as JSON
- See Also:
- Constant Field Values
-
ATTRIBUTE_ORDER
public static final java.lang.String ATTRIBUTE_ORDER
saxon:attribute-order = list of attribute namesDefines an ordering for attributes in the serialized output. Any attribute present in the list will appear correctly ordered according to the list; other attributes will be ordered first by namespace, then by local name.
- See Also:
- Constant Field Values
-
CANONICAL
public static final java.lang.String CANONICAL
saxon:canonical = yes/noWhen used in conjunction with the XML output method, delivers the output in C14N canonical form. Any serialization properties inconsistent with C14N (for example, encoding, indent, or character maps) are ignored if saxon:canonical=yes is specified. Provisions of the W3C serialization specification (for example, requiring the use of empty element tags) are also ignored.
- Since:
- 9.9
- See Also:
- Constant Field Values
-
PROPERTY_ORDER
public static final java.lang.String PROPERTY_ORDER
saxon:property-order = list of stringsDefines an ordering for properties in the serialized JSON output of a map. Any property present in the list will appear correctly ordered according to the list; other attributes will be ordered by name.
- See Also:
- Constant Field Values
-
DOUBLE_SPACE
public static final java.lang.String DOUBLE_SPACE
saxon:double-space = list of element namesDefines elements that will have an extra blank line added before the start tag, in addition to normal indentation
- See Also:
- Constant Field Values
-
NEWLINE
public static final java.lang.String NEWLINE
saxon:newline = stringDefines the sequence of characters used to represent a newline when using the text output method
- See Also:
- Constant Field Values
-
STYLESHEET_VERSION
public static final java.lang.String STYLESHEET_VERSION
stylesheet-version. This serialization parameter is set automatically by the XSLT processor to the value of the version attribute on the principal stylesheet module. This is because in backwards compatibility mode (version="1.0") the default output method for an XHTML result document is XML rather than XHTML.- See Also:
- Constant Field Values
-
USE_CHARACTER_MAPS
public static final java.lang.String USE_CHARACTER_MAPS
use-character-map = list-of-qnames.Defines the character maps used in this output definition. The QNames are represented in EQName notation as Q{uri}local-name.
- See Also:
- Constant Field Values
-
INCLUDE_CONTENT_TYPE
public static final java.lang.String INCLUDE_CONTENT_TYPE
include-content-type = "yes" | "no". This attribute is defined in XSLT 2.0Indicates whether the META tag is to be added to HTML output
- See Also:
- Constant Field Values
-
UNDECLARE_PREFIXES
public static final java.lang.String UNDECLARE_PREFIXES
undeclare-prefixes = "yes" | "no". This attribute is defined in XSLT 2.0Indicates XML 1.1 namespace undeclarations are to be output when required
- See Also:
- Constant Field Values
-
ESCAPE_URI_ATTRIBUTES
public static final java.lang.String ESCAPE_URI_ATTRIBUTES
escape-uri-attributes = "yes" | "no". This attribute is defined in XSLT 2.0Indicates whether HTML attributes of type URI are to be URI-escaped
- See Also:
- Constant Field Values
-
CHARACTER_REPRESENTATION
public static final java.lang.String CHARACTER_REPRESENTATION
representation = rep1[;rep2].Indicates the preferred way of representing non-ASCII characters in HTML and XML output. rep1 is for characters in the range 128-256, rep2 for those above 256.
- See Also:
- Constant Field Values
-
NEXT_IN_CHAIN
public static final java.lang.String NEXT_IN_CHAIN
saxon:next-in-chain = URI.Indicates that the output is to be piped into another XSLT stylesheet to perform another transformation. The auxiliary property NEXT_IN_CHAIN_BASE_URI records the base URI of the stylesheet element where this attribute was found.
- See Also:
- Constant Field Values
-
NEXT_IN_CHAIN_BASE_URI
public static final java.lang.String NEXT_IN_CHAIN_BASE_URI
- See Also:
- Constant Field Values
-
PARAMETER_DOCUMENT
public static final java.lang.String PARAMETER_DOCUMENT
parameter-document = URI.Indicates that the output is to be piped into another XSLT stylesheet to perform another transformation. The auxiliary property NEXT_IN_CHAIN_BASE_URI records the base URI of the stylesheet element where this attribute was found.
- See Also:
- Constant Field Values
-
PARAMETER_DOCUMENT_BASE_URI
public static final java.lang.String PARAMETER_DOCUMENT_BASE_URI
- See Also:
- Constant Field Values
-
BYTE_ORDER_MARK
public static final java.lang.String BYTE_ORDER_MARK
byte-order-mark = yes|no.Indicates whether UTF-8/UTF-16 output is to start with a byte order mark. Values are "yes" or "no", default is "no"
- See Also:
- Constant Field Values
-
NORMALIZATION_FORM
public static final java.lang.String NORMALIZATION_FORM
normalization-form = NFC|NFD|NFKC|NFKD|non.Indicates that a given Unicode normalization form (or no normalization) is required.
- See Also:
- Constant Field Values
-
RECOGNIZE_BINARY
public static final java.lang.String RECOGNIZE_BINARY
recognize-binary = yes|no.If set to "yes", and the output is being written using output method "text", Saxon will recognize two processing instructions <?hex XXXX?> and <b64 XXXX?> containing binary data encoded as a hexBinary or base64 string respectively. The corresponding strings will be decoded as characters in the encoding being used for the output file, and will be written out to the output without checking that they represent valid XML strings.
- See Also:
- Constant Field Values
-
REQUIRE_WELL_FORMED
public static final java.lang.String REQUIRE_WELL_FORMED
saxon:require-well-formed = yes|no.Indicates whether a user-supplied ContentHandler requires the stream of SAX events to be well-formed (that is, to have a single element node and no text nodes as children of the root). The default is "no".
- See Also:
- Constant Field Values
-
SUPPLY_SOURCE_LOCATOR
public static final java.lang.String SUPPLY_SOURCE_LOCATOR
supply-source-locator = yes|no.If set to "yes", and the output is being sent to a SAXResult (or to a user-supplied content handler), indicates that the SAX Locator made available to the ContentHandler will contain information about the location of the context node in the source document as well as the location in the stylesheet or query.
- See Also:
- Constant Field Values
-
WRAP
public static final java.lang.String WRAP
wrap="yes"|"no".This property is only available in the XQuery API. The value "yes" indicates that the result sequence produced by the query is to be wrapped, that is, each item in the result is represented as a separate element. This format allows any sequence to be represented as an XML document, including for example sequences consisting of parentless attribute nodes.
- See Also:
- Constant Field Values
-
UNFAILING
public static final java.lang.String UNFAILING
Property saxon:unfailing used to indicate that serialization should not fail. This is used when a serialization method such as XML or JSON is invoked from the ADAPTIVE serialization method, and it tailors the error-handling behaviour of the subsidiary output method. There is nothing to stop the property being set directly by the user, though (at least in the XSLT case) the resulting behaviour is non-conformant. The values of the property are yes/no.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseListOfNodeNames
public static java.lang.String parseListOfNodeNames(java.lang.String value, NamespaceResolver nsResolver, boolean useDefaultNS, boolean prevalidated, boolean allowStar, java.lang.String errorCode) throws XPathException
Process a serialization property whose value is a list of element names, for example cdata-section-elements- Parameters:
value
- The value of the property as writtennsResolver
- The namespace resolver to use; may be null if prevalidated is set or if names are supplied in EQName formatuseDefaultNS
- True if unprefixed names are to be treated as being in the default namespaceprevalidated
- true if the property has already been validatedallowStar
- true if the pseudo-name "*" is permitted; it will be retained in the outputerrorCode
- The error code to return in the event of problems- Returns:
- The list of element names with lexical QNames replaced by EQName names, starting with a single space
- Throws:
XPathException
- if any error is found in the list of element names, for example, an undeclared namespace prefix
-
isUnstrippedProperty
public static boolean isUnstrippedProperty(java.lang.String key)
Ask whether a particular serialization property is to be considered as string-valued, in which case the value is used exactly as specified without any whitespace stripping.The logic here is a little pragmatic.
For XSLT (xsl:output and xsl:result-document) the properties doctype-system, doctype-public, item-separator, and media-type have string type and whitespace should therefore be retained.
For values in a parameter document, doctype-system is not whitespace stripped (and is restricted by a pattern); doctype-public is whitespace-stripped; media-type is whitespace-stripped
For values in an fn:serialize parameter map, doctype-system, doctype-public, encoding, item-separator, media-type, and version are non-stripped strings
XQuery output declarations follow the rules for parameter documents
Pragmatically, it makes sense to be consistent. Including whitespace in doctype-system, doctype-public, encoding, version, or media-type is never useful. So we apply whitespace-stripping to all properties other than item-separator.
- Parameters:
key
- the property name, in Clark notation- Returns:
- true if the property is retained as written without whitespace stripping
-
isXhtmlHtmlVersion5
public static boolean isXhtmlHtmlVersion5(java.util.Properties properties)
Examine the already-validated properties to see whether the html-version property is present with the decimal value 5.; used to decide whether to produce XHTML 5.0 in the XHTML output method.- Parameters:
properties
- the properties to be examined- Returns:
- true if the properties include html-version="5.0". The property is a decimal value, so it can also be written, for example, "5" or "+5.00".
-
isHtmlVersion5
public static boolean isHtmlVersion5(java.util.Properties properties)
Examine the already-validated properties to see whether the html-version property is present with the decimal value 5.0, or if absent, the version property is present with the value 5.0. Used to decide whether to produce HTML5 output in the HTML output method.- Parameters:
properties
- the properties to be examined- Returns:
- true if the properties include html-version="5.0". The property is a decimal value, so it can also be written, for example, "5" or "+5.00".
-
isBuildTree
public static boolean isBuildTree(java.util.Properties properties)
-
-