This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Applying two transformations consecutively


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]