cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Stimmel <jon-li...@stimmel.net>
Subject Re: XSLT merge?
Date Thu, 25 May 2000 19:20:47 GMT
On Thu, May 25, 2000 at 12:57:28PM -0400, COFFMAN Steven wrote:

> 	Does anyone know how to merge XSLT result trees? For instance, I
> need to create an HTML page with a table of contents at the top of the same
> page. The tree needs to be walked twice, but transformed differently the
> second time. I'd be really grateful if anyone has a solution.

Easy, just use different modes within the stylesheet:

  <xsl:template match="page">
    <!-- html -->
    <xsl:apply-templates select="section" mode="toc"/>
    <!-- html -->
    <xsl:apply-templates select="section"/> <!-- default rules -->
    <!-- html -->
  </xsl:template>

  <xsl:template match="section" mode="toc">
    <!-- produce table of contents -->
  </xsl:template>

  <xsl:template match="section">
    <!-- produce full view -->
  </xsl:template>

Mime
View raw message