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

RE: Recursive Template Application

Subject: RE: Recursive Template Application
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 19 Jun 2000 09:59:32 +0100
RE: Recursive Template Application
> This stylesheet works only half-way in that it correctly 
> transforms "<toc/>" to "<section .../>" but leaves it at that. The output
of T1 
> is not matched by T2. But how can I enforce this, so that "<toc/>" is 
> finally transformed to "<h2>..."? Should I run the XSL processor twice? Or
is there a more
> efficient way to accomplish this?
> 
XSLT is a "single-pass" process, all template rules are applied to the input
document (or tree), there's no standard way within the language of applying
a second transformation to the result of the first.

There are two ways round this:

1: the node-set() extension (available in xt, saxon, and in a different form
in MSXML3). This allows you to convert a result-tree-fragment to a node-set.
So you first template rule can generate an r-t-f, you can then convert this
to a node-set, and apply further templates to that nodeset.

2: perform several transformations in series, using different stylesheets.
You can control this from the API of your chosen XSLT processor, or in the
case of Saxon, you can control it from within the stylesheet by writing e.g.
<saxon:output next-in-chain="phase2.xsl">

Mike Kay


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


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.