This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Changing encoding using a parameter
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Changing encoding using a parameter
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Thu, 29 Mar 2001 09:59:52 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> I want to change the encoding of an XML file based on a
> parameter that I
> pass into the XSL. How would I go about doing that?
As others have pointed out, you can't parameterise the encoding in standard
XSLT 1.0, though you can in XSLT 1.1. (it's allowed in Saxon).
But XSLT is rather heavyweight if all you want to do is change the encoding:
you could simply use a JAXP 1.1 identity transformer:
Transformer t = TransformerFactory.newInstance().newTransformer();
t.setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
t.transform(source, result);
No stylesheet needed, and a typical implementation will not need to build
the source document tree.
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list