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

Re: grouping + global variable (?) (was re: regexs, g

Subject: Re: grouping + global variable (?) (was re: regexs, grouping (?) and XSLT2?)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 12 Aug 2004 17:29:44 -0400
xsl set global variable
Bruce,

At 04:56 PM 8/12/2004, you wrote:
OK. I understand this conceptually, but I never understood how to create -- and to access -- this "intermediate version".

There are several approaches to doing this kind of pipelining:


1. Poor man's version: run two stylesheets in succession: the second runs on the result of the first. Good for prototyping and debugging and even works in a production environment. Downside: very old-fashioned; slow; requires cleanup.

2. Extended XSLT 1.0: create your first result by applying templates to your source and binding the results to a variable, which you then use a processor extension to turn into a node set for further processing. You'll probably need modes (if only to keep yourself sane), so:

<xsl:variable name="intermediate-result">
  <xsl:apply-templates select="/" mode="pass1"/>
</xsl:variable>

<xsl:template match="/">
<xsl:apply-templates select="exslt:node-set($intermediate-result)" mode="pass2"/>
</xsl:template>


<xsl:template match="/" mode="pass1">
  <xsl:apply-templates select="pass1"/>
</xsl:template>

where exslt:node-set is an extension function that creates a node-set from a result-tree-fragment (see exslt.org or consult your processor's documentation).

3. XSLT 2.0 -- same as 2, except no extension function is needed: it'll happen transparently.

4. External pipeline support: many environments, and some processors, allow you to chain stylesheets directly, thereby eliminating the need to write out the intermediate result as a file (as option 1 does). This is the in-between solution. For example, Saxon has a saxon:next-in-chain attribute you can use on xsl:output.

Jeni was less than specific because there are so many ways to do this, which you should use depends on your own case, and she has a baby to feed. (Waa!)

Cheers,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

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.