Processing the output of another XSLT Stylesheet -
Processing the output of another XSLT Stylesheet -
i have xslt stylesheet produces output in xml. want processes output stylesheet. there way tell latter stylesheet "run , use" results former?
there not, far know, standard way tell xslt processor run stylesheet on given input , output. in cases can process input against 1 set of templates , save result in variable, apply different set of templates value of variable, this:
<xsl:template match="/"> <xsl:variable name="temp"> <xsl:apply-templates mode="first-pass"/> </xsl:variable> <xsl:apply-templates select="$temp" mode="second-pass"/> </xsl:template>
this assumes you're running xslt 2.0. in xslt 1.0 need processor supports node-set extension (many do), , you'll need alter reference $temp exslt:nodeset($temp).
as perceive, won't work if 2 stylesheets both utilize default mode , operate on overlapping sets of element types. xslt processors have added extensions provide kind of functionality describe (see, example, discussions of xalan pipe:pipedocument extension element).
of course, can handle pipe outside of xslt. simplest way depends upon environment running in.
if you're running xslt operating scheme shell , xslt processor accepts input on stdin, can pipe output 1 stylesheet other:
xsltproc a.xsl in.xml | xsltproc b.xsl - > out.xml
and mohammed moh has pointed out, many scripting environments create possible similar things: mentions php, , of course of study there's xproc.
xslt
Comments
Post a Comment