Name

XSLTProcessor: transform XML with XSLT stylesheets — Firefox 1.0, Safari 2.01, Opera 9: Object → XSLTProcessor

Constructor

new XSLTProcessor( )

Methods

clearParameters( )

Deletes any previously set parameters.

getParameter( )

Returns the value of a named parameter.

importStyleSheet( )

Specifies the XSLT stylesheet to be used.

removeParameter( )

Deletes a named parameter.

reset( )

Resets the XSLTProcessor to its initial state, clearing all parameters and stylesheets.

setParameter( )

Sets a named parameter to a specified value.

transformToDocument( )

Transforms the specified document or node using the stylesheet passed to importStylesheet( ) and parameters passed to setParameter( ). Returns the result as a new Document object.

transformToFragment( )

Transforms the specified document or node, returning the result as a DocumentFragment.

Description

The XSLTProcessor transforms XML document nodes using XSLT stylesheets. Create an XSLTProcessor object with the no-argument constructor, and initialize it with an XSLT stylesheet with the importStylesheet( ) method. If your stylesheet uses parameters, you can set those with setParameter( ). Finally, perform an actual XSL transformation with tranformToDocument( ) or transformToFragment( ).

Internet Explorer supports XSLT but does not implement the XSLTProcessor object. See the IE-specific transformNode( ) and transformNodeToObject( ) methods of Node, and see Chapter 21 for XSLT examples and cross-platform utility functions.

See Also

Node.transformNode( ...

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.