Package org.htmlunit.javascript.host.xml
Class XSLTProcessor
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.javascript.HtmlUnitScriptable
-
- org.htmlunit.javascript.host.xml.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 forXSLTProcessor
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>
parameters_
private Node
style_
-
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.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
-
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
-
-
-
-
Field Detail
-
style_
private Node style_
-
parameters_
private final java.util.Map<java.lang.String,java.lang.Object> parameters_
-
-
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
-
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 transformedoutput
- 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 parameterlocalName
- the local name of the XSLT parametervalue
- 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 parameterlocalName
- 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)
-
-