transform. XSL transformation

^document.transform[template]
^document.transform[template][XSLT-parameters]

This method applies XSL transformation to the
document using specified template. One can also specify XSLT-parameters.

Template-either path_to_template_file or xdoc document.
Parser can load XML from arbitrary source, see "Reading XML from arbitrary source".

XSLT-
parameters
- hash of strings, which can be accessed in templates via <xsl:param … />.

Note: Parser (as Apache module or IIS) module) caches the result of
template_file compilation into internal form. Recompilation is not performed. Instead, already compiled template is taken from cache. CGI-version caches the template, too, but for a single request only. The template is recompiled if modification date of any of template files has changed.

Example (see also "Lesson 6. Working with XML")
source xdoc document
$sourceDoc[^xdoc::load[article.xml]]

transformation of xdoc document using template article.xsl$transformedDoc[^sourceDoc.transform[article.xsl]]

outputting result as HTML
^transformedDoc.
string[
    
$.method[html]
]

If template is not loaded from disk but created dynamically, it is important to determine where
<xsl:import href="some.xsl"/> should be taken from, since, in this case, document's base path does not exist and its directory, therefore, cannot be determined. That means, you will need to specify base path in standard "xml:base" attribute.


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 28.05.2004