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

Re: numbering and document()

Subject: Re: numbering and document()
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Fri, 22 Aug 2003 14:03:42 -0500
xsl variable saving previous values
Wendell Piez wrote:


The cleanest way to do this (IMO) would be to separate your processing into two steps: do the merge first, then style the resulting composite document. There may be other ways, but my guess they'd be ugly and hackish.

As it happens I just had to do this for a current project. I find it works well to do a "transclusion" pass, saving the result in a variable and then just do "apply templates" on that variable.

Here's the basic technique I use:

<xsl:template match="/">
    <xsl:when test="//include"><!-- Any inclusions in top-level doc? -->
     <xsl:variable name="transcluded-doc">
       <xsl:call-template name="do-transclusion"/>
     <xsl:apply-templates select="$transcluded-doc" mode="normal"/>
      <xsl:apply-templates select="/" mode="normal"/>

<xsl:template match="/" mode="normal">

The "do-transclusion" template is just an identity transform plus handling for the inclusions. If you want to be really sophisticated you can do id and reference rewriting (for example, to implement XInclude in a way that allows component documents to have the same ID values).


W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.