[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: How to concatenate/merge two independent XSLT sty

Subject: RE: How to concatenate/merge two independent XSLT stylesheets into ONE stylesheet?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 4 Nov 2009 13:51:55 -0000
RE:  How to concatenate/merge two independent XSLT  sty
There are much more efficient ways of creating a pipeline than using "|" on
the command line, but presumably they are ruled out too.

There's no foolproof way of doing this without manually checking for
conflicting names of templates, global variables, keys etc. If you've been
very disciplined then these will all be in namespaces, and it will all be
much easier, but unless you are a very faithful disciple of Ken Holman then
this is unlikely to be the case.

You should change one of the stylesheets (or preferably both) to use named
modes on all template rules and calls of apply-templates.

Then finally you can stitch them together with

<xsl:template match="/">
  <xsl:variable name="temp">
    <xsl:apply-templates select="." mode="phase1"/>
  </xsl:variable>
  <xsl:apply-templates select="$temp" mode="phase2"/>
</xsl:template>

Alternatively, if you don't mind a product-specific solution, use
saxon:next-in-chain on the xsl:output element.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  

> 
> I have two independent XSLT style sheets which work fine when 
> they are executed in two steps:
> 
> mydoc1.xml-->mysheet1.xsl-->mydoc2.xml-->mysheet2.xsl-->mydoc3.xml
> 
> However I would like to avoid the intermediate step (and the 
> creation of mydoc2.xml).
> Is there a way to concatenate the two XSLT stylesheets resp. 
> use the output of the first stylesheet templates as input of 
> second stylesheet templates?
> 
> Due to other requirements a piping with the well known pipe 
> symbol (|) on the console is NOT allowed. The two stylesheets 
> MUST be merged together somehow into ONE physical stylesheet file.
> 
> How can I do this?
> 
> Ben

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.