Reputation: 1950
I have an xml file with this header;
<?xml version='1.0' encoding='windows-1252'?>
I want to replace the encoding value so it looks like this;
<?xml version='1.0' encoding='utf-16'?>
Any suggestions on how to accomplish this using xsl version 1?
Upvotes: 0
Views: 1059
Reputation: 12075
Have a look at the <xsl:output encoding='utf-16' />
tag.
http://www.w3schools.com/xsl/el_output.asp
As far as managing how it's input, that's up to the XML parser. The identity template with the extra <xsl:output
element should be all you need.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-16"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Upvotes: 1