RE: [xsl] Applying two transformations consecutively

Subject: RE: [xsl] Applying two transformations consecutively
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Mon, 25 Jun 2001 17:13:01 +0100
> I do have two .xsl transformations in two files which should
> be applied
> consecutively. The first xsl file includes something like
>   <xsl:template match="ELEMENT">
> 	...
>   </xsl:template>
> The other xsl file includes a rule which operates on the same
> could call xslt two times for each of the two files. But I
> would like to
> merge these files for speed resons to call xslt only once.
> If I use xsl:include only the rule defined last will be
> applied. What I
> would like to have is that the rule of the first file is
> executed first and
> the result is fed to the second rule.

You can do a two-phase transformation in a single stylesheet by using the
node-set() extension function. The typical pattern is:

<xsl:variable name="phase1out">
  <xsl:apply-templates select="/" mode="phase1"/>

<xsl:template match="/">
  <xsl:apply-templates select="xx:node-set($phase1out)" mode="phase2"/>

Mike Kay
Software AG

 XSL-List info and archive:

Current Thread