Class TransformerImpl


  • public class TransformerImpl
    extends AbstractTransformerImpl
    Saxon implementation of the JAXP Transformer interface.

    Since Saxon 9.6, JAXP interfaces are implemented as a layer above the s9api interface

    • Method Detail

      • transform

        public void transform​(Source xmlSource,
                              Result outputTarget)
                       throws XPathException

        Transform the XML Source to a Result. Specific transformation behavior is determined by the settings of the TransformerFactory in effect when the Transformer was instantiated and any modifications made to the Transformer instance.

        An empty Source is represented as an empty document as constructed by DocumentBuilder.newDocument(). The result of transforming an empty Source depends on the transformation behavior; it is not always an empty Result.

        Overrides:
        transform in class IdentityTransformer
        Parameters:
        xmlSource - The XML input to transform.
        outputTarget - The Result of transforming the xmlSource.
        Throws:
        XPathException - If an unrecoverable error occurs during the course of the transformation.
      • setURIResolver

        public void setURIResolver​(URIResolver resolver)
        Set an object that will be used to resolve URIs used in document().

        If the resolver argument is null, the URIResolver value will be cleared and the transformer will no longer have a resolver.

        Overrides:
        setURIResolver in class IdentityTransformer
        Parameters:
        resolver - An object that implements the URIResolver interface, or null.
      • setInitialTemplate

        public void setInitialTemplate​(String name)
        Supply an initial template for a transformation.

        This is a Saxon extension to the JAXP interface, needed for XSLT 2.0

        Changed in 9.9 so it no longer validates the supplied name; an incorrect name will lead to an error later.

        Parameters:
        name - the name of the initial template, in Clark notation (either a local name, or "{uri}local")
      • setInitialMode

        public void setInitialMode​(String name)
                            throws IllegalArgumentException
        Supply an initial mode for a transformation.

        This is a Saxon extension to the JAXP interface, needed for XSLT 2.0

        Parameters:
        name - the name of the initial mode, in Clark notation (either a local name, or "{uri}local")
        Throws:
        IllegalArgumentException - if the argument is invalid, for example if the format of the name is incorrect or if there is no mode with this name or if the mode is private
      • getUnderlyingXsltTransformer

        public XsltTransformer getUnderlyingXsltTransformer()
        Get the underlying s9api implementation class wrapped by this JAXP Transformer
        Returns:
        the underlying s9api XsltTransformer
      • getUnderlyingController

        public XsltController getUnderlyingController()
        Get the internal Saxon Controller instance that implements this transformation. Note that the Controller interface will not necessarily remain stable in future releases
        Specified by:
        getUnderlyingController in class AbstractTransformerImpl
        Returns:
        the underlying Saxon Controller instance
      • newTransformerHandler

        public TransformerHandler newTransformerHandler()
        Create a JAXP TransformerHandler to perform the transformation
        Returns:
        a JAXP TransformerHandler, which allows the transformation to be performed in "push" mode on a SAX pipeline.
      • newXMLFilter

        public XMLFilter newXMLFilter()
        Create a JAXP XMLFilter which allows this transformation to be added to a SAX pipeline
        Specified by:
        newXMLFilter in class AbstractTransformerImpl
        Returns:
        the transformation in the form of an XMLFilter