Next in thread → Next in month →

Re: [xml-dev] Here is how to convert an XML document to a different encoding

From
Andrew Welch <>
To
"Costello, Roger L." <>
Date
2012-12-28T12:29:40Z
ID
<>
Thread
Re: [xml-dev] Here is how to convert an XML document to a different encoding
Hi Roger,

> Its encoding can be changed to another encoding using this simple XSLT program:
> ---------------------------------------------------
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                            version="1.0">
>
>     <xsl:output method="xml"
>                          encoding="Shift_JIS"/>
>
>     <xsl:template match="node()|@*">
>         <xsl:copy>
>             <xsl:apply-templates select="node()|@*"/>
>         </xsl:copy>
>     </xsl:template>

For what its worth, you could just do:

<xsl:template match="/">
  <xsl:copy-of select="."/>

as there is no need to process the input a node at a time.

Also, you might be interested in this post the other day about "node()
| @*" vs "@* |  node()" vs "@*, node()":

http://markmail.org/message/srnwfokgwqnsmcwx

(see Mike's reply too)



-- 
Andrew Welch
http://andrewjwelch.com
Next in thread → Next in month →