XProc/Multiple XSLT Pipe
Appearance
< XProc
Pipeline incorporating multiple XSLT transformations
[edit | edit source]The following pipeline uses a sequence of three different transforms with each successive XSLT transformation using the results of the previous one. Each stylesheet is specified within a pipeline/xslt element that at minimum contains a stylesheet input with the stylesheet specified in an input/document/@href.
<?xml version="1.0"?>
<p:pipeline version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
<p:xslt>
<p:input port="stylesheet">
<p:document href="first.xsl"/>
</p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="second.xsl"/>
</p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="third.xsl"/>
</p:input>
</p:xslt>
</p:pipeline>
Parameters for multiple XSL transformations
[edit | edit source]To pass parameters into the stylesheets from the XProc script use the with-param element. In the following example the first and third stylesheets both have a parameter named "foo". In the first stylesheet it is desired to have a "foo" parameter value be "one". In the third stylesheet it is desired to set a "foo" parameter to "three".
<?xml version="1.0"?>
<p:pipeline version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
<p:xslt>
<p:input port="stylesheet">
<p:document href="first.xsl"/>
</p:input>
<p:with-param name="foo" select="'one'"/>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="second.xsl"/>
</p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="third.xsl"/>
</p:input>
<p:with-param name="foo" select="'three'"/>
</p:xslt>
</p:pipeline>