[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] xslt processing XML file by applying multiple transformation

Subject: RE: [xsl] xslt processing XML file by applying multiple transformation
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 12 Jan 2005 18:53:43 -0500

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"

<!-- 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"/>


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


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 :-) :-)

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