RE: [xsl] multiple <xsl:output/>'s in one stylesheet?

Subject: RE: [xsl] multiple <xsl:output/>'s in one stylesheet?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 29 Oct 2002 13:41:43 -0000
> I've got one stylesheet that creates multiple output text 
> files (via subclassing Saxon's Emitter).  Some of those files 
> now need to be in a different output format, html.  I noticed 
> that in the XSLT Prog. Ref. that it said the <xsl:output/> 
> element, "may appear any number of times in a stylesheet".  
> It's also a top-level element.  I'm trying to determine how I 
> should be using the output element given my situation.

In XSLT 1.0, you can have more than one <xsl:output> element, but the
contents are effectively merged, you can only define one output format.

Always watch out when reading XSLT Prog Ref for the sections that say
"this is an XSLT 1.1 feature". XSLT 1.1 didn't make it to a
Recommendation and is not widely implemented. One feature that was new
in XSLT 1.1 was multiple output files.

Many products do actually support multiple output files, but the way
they control the formatting of each output file varies from one product
to another. 

And in Saxon, it varies from one release to another, as I tried to track
the changes in the spec. Up to 6.5.2, <xsl:output> only controls the
format of the main output file, the format of other files in controlled
using <saxon:output> or <xsl:document>. In 7.x, you can have multiple
named output formats, and you refer to a named output format when
creating each result tree.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> Questions:
> 1) do multiple outputs actually format the output differently 
> in different parts of the stylesheet, or is only one of them 
> used, e.g. the first or the last
> 2) if multiple outputs do format different parts of the 
> stylesheet differently, what are the rules of usage?
> 3) if i can't output multiple formats from the same 
> stylesheet, will using <xsl:output method="html"/> for the 
> text output mess anything up as long as there isn't any html 
> in the text?  (i'm guessing no)
> 4) since all the output will take place within an 
> <xsl:document method="MyEmitterClass"/> does any of this 
> matter or does the document element somehow negate the output tag
> thanks,
> +jeff
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread