[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: multiple transformations (pipelining) in one styl

Subject: Re: multiple transformations (pipelining) in one stylesheet
From: Oliver Lietz <list@xxxxxxxxxxxxxx>
Date: Fri, 19 Oct 2007 18:47:58 +0200
Re:  multiple transformations (pipelining) in one  styl
Am Freitag, 19. Oktober 2007 schrieb Michael Kay:
[...]
> Use modes to make it clear which templates apply to which phase of
> processing.

I tried to adapt your model (used your mode names to see if I understand it) 
but there must be an error, I don't get any output.

<xsl:stylesheet version="2.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>

  <xsl:template match="@*|node()" mode="phase-1">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="acronym" mode="phase-1">
    <xsl:value-of select="@text"/>
  </xsl:template>

  <xsl:template match="/" mode="phase-2">
    <p>
      <xsl:value-of select="/file/content/para"/>
    </p>
  </xsl:template>

  <xsl:variable name="phase-1-output">
    <xsl:apply-templates select="/" mode="phase-1"/>
  </xsl:variable>

  <xsl:variable name="phase-2-output">
    <xsl:apply-templates select="$phase-1-output" mode="phase-2"/>
  </xsl:variable>

  <xsl:template match="/">
    <xsl:apply-templates select="$phase-2-output" mode="phase-3"/>
  </xsl:template>

</xsl:stylesheet>

So it works like this:
1) template (match="/") pulls in result from $phase-2-output
2) $phase-2-output is build by applying phase-2 templates to $phase-1-output
3) $phase-1-output is build by applying phase-1 templates to root of document

Am I right?

O.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.