XML : Excel VBA is converting my ‘™’ (Trademark TM) in my XML to ‘T’ when I run an XSLT which coverts UTF-8 to ISO-8859-1

I have the following XSLT to take an XML encoded UTF-8, that was originally created from Excel, and create the same XML but encode ISO-8859-1

  <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">  <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>      <xsl:template match="@* | node()">          <xsl:copy>              <xsl:apply-templates select="@*|node()"/>          </xsl:copy>      </xsl:template>  </xsl:stylesheet>    

It works well and when I use XMLspy to run the transform the becomes &#8482 which is great. The issue I have is when I use the following Excel VBA, thank you Parfait, to run the XSLT the in the XML becomes T.

  Set xmldoc = CreateObject("MSXML2.DOMDocument")  Set xsldoc = CreateObject("MSXML2.DOMDocument")  Set newdoc = CreateObject("MSXML2.DOMDocument")    'LOAD XML  xmldoc.async = False  xmldoc.Load "path and file name & fileName.xml"    'LOAD XSL  xsldoc.async = False  xsldoc.Load "path and file name.xslt"    'TRANSFORM  xmldoc.transformNodeToObject xsldoc, newdoc  newdoc.Save "Path and file name.xml"    

I don't understand why when Excel runs the XSLT the results are different. I originally research if the Excel could export XML encoded ISO-8859-1 in the first place but that does not seem to be an option. Any suggestions?

No comments:

Post a Comment