"Jiho Han" <jiho.han@infinityinfo.com> wrote in message
news:uokt67z7DHA.1816@TK2MSFTNGP12.phx.gbl...
> This is my xsl header section:
>
> <?xml version="1.0" ?>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"> >
> <xsl:output encoding="utf-8" indent="no" media-type="text/xml"
> method="xml"/>
>
> This is my data:
>
> <association>
>
> <associationid>5b5acf84-6a76-4447-ad88-dc0b7d031741</associationid>
>
>
>
> </association>
>
> Here's my code for the transform:
>
> XmlDocument xdoc = new XmlDocument();
>
> xdoc.LoadXml(dataXml);
>
> XmlDeclaration xmldecl;
>
> xmldecl = xdoc.CreateXmlDeclaration("1.0", null, null);
>
> xmldecl.Encoding="UTF-8";
>
> xdoc.InsertBefore(xmldecl, xdoc.DocumentElement);
>
> XslTransform xslt = new XslTransform();
>
> xslt.Load(Server.MapPath("client/association.xsl"));
>
> StringBuilder sb = new StringBuilder();
>
> StringWriter sw = new StringWriter(sb);
>
> xslt.Transform(xdoc, null, sw);
>
> return sb.ToString();
>
> As you can see I tried to insert a XML declaration in there but it really
> didn't do much.
> Thanks for looking into this. Much appreciated.
> Jiho
>
> "Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
> news:%23e6NK7i7DHA.2524@TK2MSFTNGP11.phx.gbl...
> > Jiho Han wrote:
> >
> > > I do a transform of an xml document into another xml using
XslTransform.
> > > In my xsl file, I specify using <xsl:output encoding="utf-8"/>.
> However,
> > > when my transform is done, the resulting xml is in utf-16.
> >
> > Show us your code. <xsl:output encoding="utf-8"/> only works when you
> > transform to Stream. Otherwise it's ignored and other stuff defines
> > output encoding.
> > --
> > Oleg Tkachenko [XML MVP, XmlInsider]
> >
http://blog.tkachenko.com >
>