This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Changing encoding using a parameter


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]