RE: [xsl] XML Input -> XML OR Text as output

Subject: RE: [xsl] XML Input -> XML OR Text as output
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 4 Oct 2005 19:43:34 +0100
You've got several choices:

(a) you can import your method="xml" stylesheet from a method="text"
stylesheet; the importing stylesheet will override the importee.

(b) many APIs or command line interfaces allow you to override the
serialization parameters specified within the stylesheet. For example, in
Saxon, add !method=text to the command line.

(c) in XSLT 2.0 you can generate the output using the xsl:result-document
instruction. This can compute serialization parameters at run-time (the
attributes are AVTs).

Incidentally, it's conventional to put xsl:output near the start, but it
doesn't have to be, so long as it's a top-level element (a child of
xsl:stylesheet).

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Khorasani, Houman [mailto:houman_khorasani@xxxxxxxxxxxxxx] 
> Sent: 04 October 2005 18:22
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] XML Input -> XML OR Text as output
> 
> Hello everyone,
> 
> In few words I have this problem:
> 
> I have an XML file as input.  Based on a condition I would like to
> produce the output in XML or in TEXT.
> 
> However the output tag has to be declared in the beginning of 
> the XSLT,
> right?
> 
> <xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
> indent="yes"/>
> 
> Or can I set this later within an if-condition?
> 
> Many thanks,
> Houman

Current Thread