Link to home
Start Free TrialLog in
Avatar of egono
egono

asked on

preserve entities

i'm using MSXML to transform some XML data to HTML
the XML contains entities like ü and others
my problem is, that after the transformations the entities
are gone (resolved and displayed as the described
character u-umlaut)
is there a way to preserve the entities or to recreate
them after the transformation?

here is some sample code (probably not working):

-------test.xml (start)-------
<?xml version="1.0" ?>
<!DOCTYPE test [
          <!ENTITY % ISOlat1
          PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN//XML"
          "http://www.icaap.org/software/ixml/ixml/ent/ISOlat1.pen">
          %ISOlat1;
]>

<test>
  <mytags>
      <tag1>Ue - &Uuml;</tag1>
      <tag2>Ae - &Auml;</tag2>
      <tag3>Oe - &Ouml;</tag3>
      <tag4>ue - &uuml;</tag4>
      <tag5>ae - &auml;</tag5>
      <tag6>oe - &ouml;</tag6>
  </mytags>
</test>
-------test.xml (end)-------

-------test.xsl (start)-------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:output method="html"/>
<xsl:template match="test">
  <html><body>
    <xsl:apply-templates/>
  </body></html>
</xsl:template>

<xsl:template match="mytags">
  <p>
    <xsl:value-of select="tag1"/><br/>
    <xsl:value-of select="tag2"/><br/>
    <xsl:value-of select="tag3"/><br/>
    <xsl:value-of select="tag4"/><br/>
    <xsl:value-of select="tag5"/><br/>
  </p>
</xsl:template>
</xsl:stylesheet>
-------test.xsl (end)-------


ASKER CERTIFIED SOLUTION
Avatar of PeterCiuffetti
PeterCiuffetti
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of egono
egono

ASKER

excellent working answer - thank you very much

my output have to be HTML with correct encoded characters,
so I need to convert the umlauts - speed doesn't matter
in this case