Class TemplatesImpl

  • All Implemented Interfaces:
    javax.xml.transform.Templates

    public class TemplatesImpl
    extends java.lang.Object
    implements javax.xml.transform.Templates
    Saxon implementation of the JAXP Templates interface.

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

    • Constructor Summary

      Constructors 
      Constructor Description
      TemplatesImpl​(javax.xml.transform.TransformerFactory factory, XsltExecutable executable)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      XsltExecutable getImplementation()
      Get the underlying implementation object
      java.util.Properties getOutputProperties()
      Get the properties corresponding to the effective xsl:output element.
      boolean isForceStreaming()
      Ask whether any transformer created from this Templates object should have streaming behaviour.
      javax.xml.transform.Transformer newTransformer()
      Create a new transformation context for this Templates object.
      void setForceStreaming​(boolean forceStreaming)
      Say that any transformer created from this Templates object should have streaming behaviour.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TemplatesImpl

        public TemplatesImpl​(javax.xml.transform.TransformerFactory factory,
                             XsltExecutable executable)
    • Method Detail

      • newTransformer

        public javax.xml.transform.Transformer newTransformer()
        Create a new transformation context for this Templates object.
        Specified by:
        newTransformer in interface javax.xml.transform.Templates
        Returns:
        A valid non-null instance of a Transformer.
      • getOutputProperties

        public java.util.Properties getOutputProperties()
        Get the properties corresponding to the effective xsl:output element. The object returned will be a clone of the internal values. Accordingly, it can be mutated without mutating the Templates object, and then handed in to Transformer.setOutputProperties(java.util.Properties).

        The properties returned should contain properties set by the stylesheet, and these properties are "defaulted" by default properties specified by section 16 of the XSL Transformations (XSLT) W3C Recommendation. The properties that were specifically set by the stylesheet should be in the base Properties list, while the XSLT default properties that were not specifically set should be in the "default" Properties list. Thus, getOutputProperties().getProperty(String key) will obtain any property in that was set by the stylesheet, or the default properties, while getOutputProperties().get(String key) will only retrieve properties that were explicitly set in the stylesheet.

        For XSLT, Attribute Value Templates attribute values will be returned unexpanded (since there is no context at this point). The namespace prefixes inside Attribute Value Templates will be unexpanded, so that they remain valid XPath values.

        Specified by:
        getOutputProperties in interface javax.xml.transform.Templates
        Returns:
        A Properties object, never null.
      • isForceStreaming

        public boolean isForceStreaming()
        Ask whether any transformer created from this Templates object should have streaming behaviour. Specifically this means that when a SAXSource or StreamSource is supplied as input to the transform() method, provided that the initial mode is actually streamable, then the source object is not materialized as the global context item, so any reference to the global context item from within a global variable will fail with dynamic error XPDY0002.
        Returns:
        true if streaming behaviour is enforced for any generated Transformer object.
      • setForceStreaming

        public void setForceStreaming​(boolean forceStreaming)
        Say that any transformer created from this Templates object should have streaming behaviour. Specifically this means that when a SAXSource or StreamSource is supplied as input to the transform() method, provided that the initial mode is actually streamable, then the source object is not materialized as the global context item, so any reference to the global context item from within a global variable will fail with dynamic error XPDY0002.
        Parameters:
        forceStreaming - true if streaming behaviour is to be enforced for any generated Transformer object.
      • getImplementation

        public XsltExecutable getImplementation()
        Get the underlying implementation object
        Returns:
        the underlying S9API XsltExecutable object