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

RE: xslt processing XML file by applying multiple tra

Subject: RE: xslt processing XML file by applying multiple transformation
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Jan 2005 18:53:43 -0500
xslt multiple passes
Another approach (as long as you're using an extension): Saxon has a nice way to manage this kind of thing, even nicer if you use it with a "wrapper" stylesheet. Something like this:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:saxon="http://icl.com/saxon">

<!-- this stylesheet runs the first pass and hands the
     result to be run with the second pass -->

<xsl:import href="pass-one.xsl"/>

<xsl:output saxon:next-in-chain="pass-two.xsl"/>

</xsl:stylesheet>

This way the two passes can still be maintained in separate stylesheets. Execute the transform with the wrapper, and both passes are run on the source in sequence.

Mike can confirm what's being passed here -- I think it might be SAX events, not a result tree as such. But it's still fast (only the final output gets written to a file), and handy. (You can even pass to a second wrapper if your chain has a third stylesheet.)

Cheers,
Wendell

At 12:27 PM 1/12/2005, Mark wrote:
>
> If I absolutely could not get it done in one pass, I'd use modes
> for this,
> as Mark Lundquist pointed out.
>
> However, it may be easier to do this as one pass than you might think. As
> Michael Kay has oft pointed out, you can write the results of your first
> transformation into a variable and then process the contents of the
> variable, giving you complete processing in one pass.

Look again, that's *exactly* what my example does :-) :-)
-ml-


======================================================================
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.