You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "mika.borner" <mi...@teliamobile.fi> on 2001/05/21 12:15:44 UTC

Document encoding

I'm using Xalan 1.2.2 and am wondering about the encoding of the documents.

As far as I know there is no standard for the XSLT processor that defines how 
to change the encoding of a document wenn applying a stylesheet to it.

E.g. I may have a ISO-8859-1 document and want to change it to UTF-8 while 
processing it with the XSL document. Is it possible to do that using a PI in 
the stylesheet? Or do I have to post or preprocess the document?

Thanks for your answer!

Re: Document encoding

Posted by Gary L Peskin <ga...@firstech.com>.
"mika.borner" wrote:
> 
> I'm using Xalan 1.2.2 and am wondering about the encoding of the documents.
> 
> As far as I know there is no standard for the XSLT processor that defines how
> to change the encoding of a document wenn applying a stylesheet to it.

Have a look at <xsl:output encoding="UTF-8"/>.  This is explained in
<http://www.w3.org/TR/xslt#output>.  
> 
> E.g. I may have a ISO-8859-1 document and want to change it to UTF-8 while
> processing it with the XSL document. Is it possible to do that using a PI in
> the stylesheet? Or do I have to post or preprocess the document?
> 
> Thanks for your answer!

Re: Document encoding

Posted by "mika.borner" <mi...@teliamobile.fi>.
> The "encoding" attribute of the <xsl:output.../> element can be used to
> define the encoding of the output document:
>
> 	<xsl:output encoding="utf-8"/>
>

Thanks.

Another problem that came into my mind is how entities are handled.

Is it possible to change entities into e.g. utf-8 characters or the other way 
around, can a utf-8 character be changed into an entity?

I remember that in a case I had once, Xalan did some entity convertions 
automaticly?

Is it processor dependend?

Re: Document encoding

Posted by Morten Jorgensen <mo...@ireland.sun.com>.
Mika,

The "encoding" attribute of the <xsl:output.../> element can be used to
define the encoding of the output document:

	<xsl:output encoding="utf-8"/>

I hope this will help you.

Morten Jorgensen
(Morten.Jorgensen@ireland.sun.com)

"mika.borner" wrote:
> 
> I'm using Xalan 1.2.2 and am wondering about the encoding of the documents.
> 
> As far as I know there is no standard for the XSLT processor that defines how
> to change the encoding of a document wenn applying a stylesheet to it.
> 
> E.g. I may have a ISO-8859-1 document and want to change it to UTF-8 while
> processing it with the XSL document. Is it possible to do that using a PI in
> the stylesheet? Or do I have to post or preprocess the document?
> 
> Thanks for your answer!