Using XSL

  XSL Transformations are performed in the xmlTree API by applying xsltStylesheet objects to xmlDoc documents.

xsltStylesheet objects are acquired by reading an XSL stylesheet from a file, from a string, or from an XSL document that's already been parsed as an xmlDoc (using xsltParseStylesheetFile, xsltParseStylesheetString, or xsltParseStylesheetDoc, respectively).

The xmlDoc's that the stylesheets are applied to are normal XML documents used throughout the xmlTree API.

The xsltStylesheet is applied to the xmlDoc with xsltApplyStylesheet, which returns the transformed result as an xmlDoc. That document can be printed or saved like any other xmlDoc, as described in the Saving section (here).


    <$doc = (xmlTreeNewDocFromString( 'example.xml'))>
    <$style = (xsltParseStylesheetString( 'example.xsl'))>
    <$result = (xsltApplyStylesheet($doc, $style))>
    <$output = (xmlTreePrintDoc($result, 'INDENT'))>
    The result is:

See the sample xmlTree10_XSL for examples using XSL.

xsltApplyStylesheet, xsltParseStylesheetDoc, xsltParseStylesheetFile, xsltParseStylesheetString

Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.