nsIXSLTProcessor

by 2 contributors:

XSLT Processor
Inherits from: nsISupports Last changed in Gecko 1.7

Implemented by: @mozilla.org/document-transformer;1?type=xslt. To create an instance, use:

var xsltProcessor = Components.classes["@mozilla.org/document-transformer;1?type=xslt"]
                    .createInstance(Components.interfaces.nsIXSLTProcessor);

Method overview

void clearParameters();
nsIVariant getParameter(in DOMString namespaceURI, in DOMString localName);
void importStylesheet(in nsIDOMNode style);
void removeParameter(in DOMString namespaceURI, in DOMString localName);
void reset();
void setParameter(in DOMString namespaceURI, in DOMString localName, in nsIVariant value);
nsIDOMDocument transformToDocument(in nsIDOMNode source);
nsIDOMDocumentFragment transformToFragment(in nsIDOMNode source, in nsIDOMDocument output);

Methods

clearParameters()

Removes all set parameters from this nsIXSLTProcessor. This will make the processor use the default-value for all parameters as specified in the stylesheet.

void clearParameters();
Parameters

None.

getParameter()

Gets a parameter if previously set by setParameter(). Returns null otherwise.

nsIVariant getParameter(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.
Return value

An nsIVariant containing the value of the parameter.

importStylesheet()

Imports the specified stylesheet into this XSLTProcessor for transformations.

void importStylesheet(
  in nsIDOMNode style
);
Parameters
style
The root-node of a XSLT stylesheet. This can be either a document node or an element node. If a document node then the document can contain either a XSLT stylesheet or a LRE stylesheet. If the argument is an element node it must be the xsl:stylesheet (or xsl:transform) element of an XSLT stylesheet.

removeParameter()

Removes a parameter, if set. This will make the processor use the default-value for the parameter as specified in the stylesheet.

void removeParameter(
  in DOMString namespaceURI,
  in DOMString localName
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.

reset()

Remove all parameters and stylesheets from this nsIXSLTProcessor.

void reset();
Parameters

None.

setParameter()

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.

void setParameter(
  in DOMString namespaceURI,
  in DOMString localName,
  in nsIVariant value
);
Parameters
namespaceURI
The namespaceURI of the XSLT parameter.
localName
The local name of the XSLT parameter.
value
The new value of the XSLT parameter.

transformToDocument()

Transforms the node source applying the stylesheet imported by importStylesheet().

nsIDOMDocument transformToDocument(
  in nsIDOMNode source
);
Parameters
source
The node to be transformed.
Return value

An Document containing the result of the transformation.

transformToFragment()

Transforms the node source applying the stylesheet imported by importStylesheet(). The created fragment will be owned by the specified output document.

nsIDOMDocumentFragment transformToFragment(
  in nsIDOMNode source,
  in nsIDOMDocument output
);
Parameters
source
The node to be transformed.
output
The document to own the returned document fragment.
Return value

A DocumentFragment containing the resulting transform.

Document Tags and Contributors

Contributors to this page: Sheppy, trevorh
Last updated by: Sheppy,