[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problem with grouping the handling of sibling node
> But what do you mean with the second pass. Do I have to invoke the > transformer with another xsl or is it possible to invoke this second > transformation within the original xsl file? It's surprising how rarely this technique is taught and discussed. Splitting complex transformations up into a pipeline of simple transformations is something that ought to be a standard design pattern used by every XSLT developer. There are two ways of doing it: multiple stylesheets, and multiple phases within a single stylesheet. I use both approaches, often within the same pipeline. Multiple stylesheets can be linked into a pipeline in a number of ways: * with your own custom Java code, e.g. using the JAXP interfaces * with a pipeline processor such as Orbeon * from a shell script * Saxon has a custom extension, saxon:next-in-chain, that allows one stylesheet to direct its output to be processed by another stylesheet Within a single stylesheet, a pipeline is expressed as a series of variables: <xsl:variable name="phase-1-output"> <xsl:apply-templates select="/" mode="phase-1"/> </xsl:variable> <xsl:variable name="phase-2-output"> <xsl:apply-templates select="$phase-1-output" mode="phase-2"/> </xsl:variable> <xsl:template match="/"> <xsl:copy-of select="$phase-8-output"/> </xsl:template> To do this in XSLT 1.0, you need the xx:node-set() extension. Using multiple stylesheets gives you greater modularity and reusability, but is a bit more complex to deploy. Importantly, it also allows you to incorporate steps into the pipeline [I've never been sure what a step in a pipeline should be called!] that are implemented using technologies other than XSLT - for example, STX, XQuery, Java SAX filters, Perl scripts. Michael Kay http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|