I'm doing some very complex XSLT 1.0 transformation (currently using 8 XSLT passes). I want to combine this 8 passes without merging them in one file (this would be too complex). My solution would be using xsl:include
and exsl:node-set
to merge the passes and store temporary results in variables.
But I have one problem: My transformation passes copies most of the nodes and modifying only certain aspects. Therefore I need to process the same nodes in every pass, but with different xsl:template
! But how do I do that? How to tell that after the first pass I want to apply templates from other XSLT stylesheet?
Very simplified example what I'm currently doing (2 XSLT passes):
Source:
<h>something here</h>
After XSLT pass 1:
<h someattribute="1">something here</h>
After XSLT pass 2:
<h someattribute="1" somemoreattribute="2">something here, and even more</h>
My current approach is to call the XSLT processor twice and saving the results temporary on disk:
xsltproc stylesheet1.xsl input.xml >temp.xml
xsltproc stylesheet2.xsl temp.xml >finalresult.xml