public class StandardResultDocumentResolver extends java.lang.Object implements ResultDocumentResolver
Constructor and Description |
---|
StandardResultDocumentResolver() |
Modifier and Type | Method and Description |
---|---|
void |
close(javax.xml.transform.Result result)
Signal completion of the result document.
|
protected javax.xml.transform.stream.StreamResult |
createResult(java.net.URI absoluteURI) |
static StandardResultDocumentResolver |
getInstance()
Get a singular instance
|
static javax.xml.transform.stream.StreamResult |
makeOutputFile(java.net.URI absoluteURI)
Create an output file (unless it already exists) and return a reference to it as a Result object
|
javax.xml.transform.stream.StreamResult |
resolve(java.lang.String href,
java.lang.String base)
Resolve an output URI
|
Receiver |
resolve(XPathContext context,
java.lang.String href,
java.lang.String baseUri,
SerializationProperties properties)
Saxon calls this method when an
xsl:result-document instruction
with an href attribute is evaluated. |
public static StandardResultDocumentResolver getInstance()
public Receiver resolve(XPathContext context, java.lang.String href, java.lang.String baseUri, SerializationProperties properties) throws XPathException
ResultDocumentResolver
xsl:result-document
instruction
with an href
attribute is evaluated.
Note: it may be appropriate for the method to obtain a suitable
Receiver
by calling one of the static factory methods on the
SerializerFactory
class. A SerializerFactory
can be
obtained by calling context.getConfiguration().getSerializerFactory()
.
resolve
in interface ResultDocumentResolver
context
- the dynamic evaluation contexthref
- the effective value of the href
attribute of
xsl:result-document
instruction. This will be a zero-length
string if the attribute is omitted.baseUri
- the base output URI of the transformation (typically, the
destination of the principal output destination). This may be null
if no base output URI is known. The recommended action if it is null
is to use the href
value alone if it is absolute URI, otherwise
to raise an error (SaxonErrorCode.SXRD0002
, since there
is no W3C-defined code for the condition).properties
- the serialization properties defined explicitly or implicitly on the
xsl:result-document
instruction, together with information
about character maps in the stylesheet that might be referenced.
Serialization parameters can be ignored if the result document is
not being serialized. However, if the serialization parameters include
a validation factory, then this must not be ignored: a validator
must be inserted at a suitable point in the output pipeline.Receiver
class, which Saxon will then call
to open the output document, and subsequently to close it. This Receiver
will receive a sequence of events representing the raw result of the
xsl:result-document
instruction, as a regular event sequence
conforming to the rules defined in RegularSequenceChecker
.
The implementation should set the systemId
property of the returned
Receiver
to the result of resolving the supplied href
against the
supplied baseUri
. On return from this method, Saxon will check that
the systemId
is non-null and that it satisfies the uniqueness conditions
imposed by the XSLT specification. Specifically, it is not permitted for two
calls on xsl:result-document
to use the same URI, and this URI must not
be read in a call on doc()
or document()
, either before or after
executing the xsl:result-document
instruction.
XPathException
- if a result document cannot be openedpublic javax.xml.transform.stream.StreamResult resolve(java.lang.String href, java.lang.String base) throws XPathException
href
- The relative URI of the output document. This corresponds to the
href attribute of the xsl:result-document instruction.base
- The base URI that should be used. This is the base output URI,
normally the URI of the principal output file.XPathException
protected javax.xml.transform.stream.StreamResult createResult(java.net.URI absoluteURI) throws XPathException, java.io.IOException
XPathException
java.io.IOException
public static javax.xml.transform.stream.StreamResult makeOutputFile(java.net.URI absoluteURI) throws XPathException
absoluteURI
- the URI of the output file (which should typically use the "file" scheme)XPathException
- if the URI is not writablepublic void close(javax.xml.transform.Result result) throws XPathException
XPathException
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.