You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by COFFMAN Steven <SC...@CBSINC.com> on 2000/05/25 18:57:28 UTC

XSLT merge?

Hi,
	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.

Things were so much easier when I stuck to FOP.

-Steve

Re: XSLT merge?

Posted by Jonathan Stimmel <jo...@stimmel.net>.
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>