Class XSLTProcessor

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.xml.XSLTProcessor
All Implemented Interfaces:
Serializable, 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:
  • 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 final Map<String,Object>
     
    private Node
     

    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
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static DomNode
    findOutputNode(DomNode xsltDomNode)
     
    getParameter(String namespaceURI, String localName)
    Gets a parameter if previously set by setParameter.
    private static String
    getQualifiedName(String namespaceURI, String localName)
     
    void
    Imports the specified stylesheet into this XSLTProcessor for transformations.
    void
    JavaScript constructor.
    void
    setParameter(String namespaceURI, String localName, Object value)
    Sets a parameter to be used in subsequent transformations with this nsIXSLTProcessor.
    private Object
    transform(Node source)
     
    Transforms the node source applying the stylesheet given by the importStylesheet() function.
    transformToFragment(Node source, 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 Details

  • Constructor Details

    • XSLTProcessor

      public XSLTProcessor()
      Default constructor.
  • Method Details

    • 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 Object transform(Node source)
      Returns:
      Node or String
    • transformToFragment

      public DocumentFragment transformToFragment(Node source, 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(String namespaceURI, String localName, 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 Object getParameter(String namespaceURI, 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 String getQualifiedName(String namespaceURI, String localName)
    • findOutputNode

      private static DomNode findOutputNode(DomNode xsltDomNode)