This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Applying two transformations consecutively
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Applying two transformations consecutively
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 25 Jun 2001 17:13:01 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> 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
> ELEMENT. I
> 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:variable>
<xsl:template match="/">
<xsl:apply-templates select="xx:node-set($phase1out)" mode="phase2"/>
</xsl:template>
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list