[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2009-11-04 14:12 +0100, Ben Stover wrote:
You can use modes and, in XSLT 2.0, temporary trees, though it will require you to modify the stylesheets and not use them untouched as they exist now. You don't have to use named modes for both steps ... you can use the default unnamed mode for one of the two steps.
The pattern would be along the lines of:
or ....
... where each stylesheet's template matches are all in the same mode.
Namespace-qualifying your top-level constructs may help too, to avoid overriding declarations.
If you have to do this with XSLT 1 then you'll need to use a vendor-supported extension to act on the node set of the result tree fragment.
I hope this helps.
. . . . . . . . . . . . . Ken
Re: [xsl] How to concatenate/merge two independent XSLT stylesheets into ONE stylesheet?
Subject: Re: [xsl] How to concatenate/merge two independent XSLT stylesheets into ONE stylesheet? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 04 Nov 2009 08:18:19 -0500 |
At 2009-11-04 14:12 +0100, Ben Stover wrote:
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?
You can use modes and, in XSLT 2.0, temporary trees, though it will require you to modify the stylesheets and not use them untouched as they exist now. You don't have to use named modes for both steps ... you can use the default unnamed mode for one of the two steps.
The pattern would be along the lines of:
<xsl:variable name="intermediate"> <xsl:apply-templates mode="step1"/> </xsl:variable> <xsl:apply-templates select="$intermediate"/>
or ....
<xsl:variable name="intermediate"> <xsl:apply-templates/> </xsl:variable> <xsl:apply-templates select="$intermediate" mode="step2"/>
... where each stylesheet's template matches are all in the same mode.
Namespace-qualifying your top-level constructs may help too, to avoid overriding declarations.
If you have to do this with XSLT 1 then you'll need to use a vendor-supported extension to act on the node set of the result tree fragment.
I hope this helps.
. . . . . . . . . . . . . Ken
-- Upcoming: hands-on XSLT, XQuery and XSL-FO Washington DC Nov 2009 Interested in other classes? http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to concatenate/merge two , Ben Stover | Thread | Re: [xsl] How to concatenate/merge , Andrew Welch |
[xsl] How to concatenate/merge two , Ben Stover | Date | Re: [xsl] How to concatenate/merge , Andrew Welch |
Month |