Subject: Re: [xsl] How to convert XML doc from UTF-8 to ISO-8859-1 char encoding? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 11 Jan 2010 09:55:09 -0500 |
> Assume I have a XML doc which is UTF-8 encoded. > > Can I convert it somehow to ISO-8859-1 encoding?
Since this is an XSLT list, I'll mention the XSLT way to do it:
Set xsl:output/@encoding to the encoding you want. Your XSLT engine has to support the encoding, naturally.
For example:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output encoding="ISO-8859-1" />
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output encoding="ISO-8859-1" /> <xsl:template match="/"><xsl:copy-of select="/"/></xsl:template> </xsl:stylesheet>
-- UBL and Code List training: Copenhagen, Denmark 2010-02-08/10 XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to convert XML doc fr, James A. Robinson | Thread | Re: [xsl] How to convert XML doc fr, G. Ken Holman |
Re: [xsl] How to convert XML doc fr, G. Ken Holman | Date | [xsl] Definite list of XSLT 2.0 pro, Abel Braaksma |
Month |