Class XSLTProcessor

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class XSLTProcessor
    extends HtmlUnitScriptable
    A JavaScript object for XSLTProcessor.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​java.lang.Object> parameters_  
      private Node style_  
      • Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
      • Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      XSLTProcessor()
      Default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static DomNode findOutputNode​(DomNode xsltDomNode)  
      java.lang.Object getParameter​(java.lang.String namespaceURI, java.lang.String localName)
      Gets a parameter if previously set by setParameter.
      private static java.lang.String getQualifiedName​(java.lang.String namespaceURI, java.lang.String localName)  
      void importStylesheet​(Node style)
      Imports the specified stylesheet into this XSLTProcessor for transformations.
      void jsConstructor()
      JavaScript constructor.
      void setParameter​(java.lang.String namespaceURI, java.lang.String localName, java.lang.Object value)
      Sets a parameter to be used in subsequent transformations with this nsIXSLTProcessor.
      private java.lang.Object transform​(Node source)  
      XMLDocument transformToDocument​(Node source)
      Transforms the node source applying the stylesheet given by the importStylesheet() function.
      DocumentFragment transformToFragment​(Node source, java.lang.Object output)
      Transforms the node source applying the stylesheet given by the importStylesheet() function.
      • Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

        applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • style_

        private Node style_
      • parameters_

        private final java.util.Map<java.lang.String,​java.lang.Object> parameters_
    • Constructor Detail

      • XSLTProcessor

        public XSLTProcessor()
        Default constructor.
    • Method Detail

      • jsConstructor

        public void jsConstructor()
        JavaScript constructor.
      • importStylesheet

        public void importStylesheet​(Node style)
        Imports the specified stylesheet into this XSLTProcessor for transformations. The specified node may be either a document node or an element node. If it is a document node, then the document can contain either a XSLT stylesheet or a LRE stylesheet. If it is an element node, it must be the xsl:stylesheet (or xsl:transform) element of an XSLT stylesheet.
        Parameters:
        style - the root-node of an XSLT stylesheet (may be a document node or an element node)
      • transformToDocument

        public XMLDocument transformToDocument​(Node source)
        Transforms the node source applying the stylesheet given by the importStylesheet() function. The owner document of the output node owns the returned document fragment.
        Parameters:
        source - the node to be transformed
        Returns:
        the result of the transformation
      • transform

        private java.lang.Object transform​(Node source)
        Returns:
        Node or String
      • transformToFragment

        public DocumentFragment transformToFragment​(Node source,
                                                    java.lang.Object output)
        Transforms the node source applying the stylesheet given by the importStylesheet() function. The owner document of the output node owns the returned document fragment.
        Parameters:
        source - the node to be transformed
        output - This document is used to generate the output
        Returns:
        the result of the transformation
      • setParameter

        public void setParameter​(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 java.lang.Object value)
        Sets a parameter to be used in subsequent transformations with this nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the parameter will be ignored.
        Parameters:
        namespaceURI - the namespaceURI of the XSLT parameter
        localName - the local name of the XSLT parameter
        value - the new value of the XSLT parameter
      • getParameter

        public java.lang.Object getParameter​(java.lang.String namespaceURI,
                                             java.lang.String localName)
        Gets a parameter if previously set by setParameter. Returns null otherwise.
        Parameters:
        namespaceURI - the namespaceURI of the XSLT parameter
        localName - the local name of the XSLT parameter
        Returns:
        the value of the XSLT parameter
      • getQualifiedName

        private static java.lang.String getQualifiedName​(java.lang.String namespaceURI,
                                                         java.lang.String localName)
      • findOutputNode

        private static DomNode findOutputNode​(DomNode xsltDomNode)