RE: [xsl] conditionally outputting with different encodings

Subject: RE: [xsl] conditionally outputting with different encodings
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 19 Oct 2006 22:24:36 +0100
3 suggestions:

The JAXP interface allows you to override xsl:output settings from the

Saxon allows you to do so from the command line (add !encoding=xyz).

In XSLT 2.0 you can use <xsl:result-document encoding="{$param}"/> 

Michael Kay

> -----Original Message-----
> From: Stephen Ciscola [mailto:cravenblackbird@xxxxxxxxx] 
> Sent: 19 October 2006 20:14
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] conditionally outputting with different encodings
> Hi!
> I'm transforming a number of xml documents into html.
> They're all exactly the same, except that their encoding can vary.
> What i want to do be able to do is use the same stylesheet 
> for each one, just telling the processor to output to 
> encoding xxx conditionally, based on whatever the encoding of 
> doc being transformed is.
> I don't see anyway to do this however.. I wish I could just 
> do something as simple as this, and pass the processor a 
> parameter each transform:
> <xsl:param name="target_enc" select="'Shift_JIS'"/> 
> <xsl:ouput method="html" encoding="{$target_enc}" />
> But that appears unsupported.
> Right now I'm using numerous stylesheets, with only one 
> element changed, <xsl:output encoding="xxx" ..../> which 
> really seems like quite a kludge, and is a hassle to keep 
> them synced. The style sheets all use the same encoding, Shift_JIS.
> Any help appreciated, this is for xslt 1.0 I should add.
> thanks!
> S.
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around 

Current Thread