Introduction
XSLT transforms are the most common means of transforming XML. NetKernel makes it
simple to apply XSL transforms and capture the results for additional processing. XSLTs can be used as
modular components of an application. Pipelined transforms make it easy to create filters, generate views on data,
or style data for presentation.
XSLT 1.0
NetKernel optimizes XSLT by transparently caching transforms. In addition it seamlessly provides the ability to use interpreted
or compiled transforms. XSLT v1.0 transformations are performed with the xslt or xsltc
accessors.
Here's an example showing a pipelined filter-presentation pattern. First a transform is applied to extract Act 1 from King Lear. The extracted
act is then transformed to XHTML and presented.
<idoc> <seq>
<instr>
<comment>
*********************************
Select Act1 from the complete play
and store as variable
*********************************
</comment>
<type>xslt</type>
<operand>../content/lear.xml</operand>
<operator>act1.xsl</operator>
<target>var:act1</target>
</instr>
<instr>
<comment>
*********************************
Transform act1 to XHTML and send to response
*********************************
</comment>
<type>xslt</type>
<operand>var:act1</operand>
<operator>act_to_html.xsl</operator>
<target>this:response</target>
</instr>
</seq>
</idoc>
Here are the documents used
-
The source data (since this is very large and intensive for browsers to render this is only showing the Act 1 Scene 1 section) view
-
The act1 filter transform view
-
The XHTML presentation transform view
XSLT 2.0
Also provided is the xslt2 accessor which supports the draft
W3C XSLT v2.0 standard. XSLT v2.0 provides many enhancements to the language and uses XPath 2.0 for path and functions.
As with the xslt v1.0 accessor all XSLT 2.0 transforms are transparently cached - furthermore the xslt2 accessor is fully backwards
compatible with v1.0 transforms. Your choice of which xslt transform accessor to use will depend on a trade-off between feature set, performance and standards maturity.