[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: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 19 Oct 2007 18:19:19 +0100
RE:  multiple transformations (pipelining) in one  styl
> 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()"/>

You need to use mode="phase-1" here (or mode="#current")

>     </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?
> 

Yes, that's the idea.

Note, the variables can either be global, or they can be local variables
within the match="/" template.

Michael Kay
http://www.saxonica.com/

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-2007 All Rights Reserved.