Hi,
I am getting a xml document from an external process which I need to transform into another xml.Now the input xml document contains some special characters like  %,#,/ etc.Is it because of the presence of these special characters that I am getting "Invalid XML character (unicode: 0x1b2da1)" error? If yes, then how should I handle these characters while applying transformation ?

I shall be very grateful for any assistance.

My input xml file looks like the following
<?xml version="1.0" encoding="UTF-8"?>
<MSCIData>
 <row>
  <col Index="1" Value="250000000046427"/>
  <col Index="2" Value="00020772293%#/1KMF5A"/>
  <col Index="3" Value="American Express Asset Management Ltd."/>
  <col Index="4" Value="11th Floor, Dashwood House 69 Old Broad Street"/>
  <col Index="5"/>
  <col Index="6" Value="London"/>
  <col Index="7"/>
  <col Index="8" Value="EC2M 1QS"/>
  <col Index="9" Value="UK"/>
  <col Index="10" Value="020 7382 9166"/>
  <col Index="11" Value="020 7382 9595"/>
  <col Index="12" Value="Y"/>
  <col Index="13"/>
  <col Index="14"/>
  <col Index="15" Value="1"/>
 </row>
 <row>
  <col Index="1" Value="250000000047044"/>
  <col Index="2" Value="00110736975+?(]74\PW"/>
  <col Index="3" Value="Weisenhorn &amp; Partner Financial Services"/>
  <col Index="4" Value="Gruneburgweg 105"/>
  <col Index="5"/>
  <col Index="6" Value="Frankfurt"/>
  <col Index="7"/>
  <col Index="8" Value="D-60323"/>
  <col Index="9" Value="Germany"/>
  <col Index="10" Value="00 49 69 716 776 0"/>
  <col Index="11" Value="00 49 69 716 776 50"/>
  <col Index="12" Value="Y"/>
  <col Index="13"/>
  <col Index="14" Value="http://www.eisenhorn.de"/>
  <col Index="15" Value="1"/>
 </row>
</MSCIData>

My xsl is as follows
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml"/>
 <xsl:template match="/MSCIData">
  <compareRoot filename="file_to_frm1.xsl">
   <xsl:apply-templates/>
  </compareRoot>
 </xsl:template>
 <xsl:template match="row">
  <row>
   <xsl:attribute name="frm_accountno">
    <xsl:value-of select="./col[position()=2]/attribute::Value"/>
   </xsl:attribute>
   <xsl:apply-templates select='col[@Index=&quot;3&quot;] | col[@Index=&quot;9&quot;]'>
    <xsl:sort select="./col[position()=2]/attribute::Value" data-type="text"/>
   </xsl:apply-templates>
  </row>
 </xsl:template>
 <xsl:template match='col[@Index=&quot;3&quot;]'>
  <companyName>
   <xsl:value-of select="./@Value"/>
  </companyName>
 </xsl:template>
 <xsl:template match='col[@Index=&quot;9&quot;]'>
  <country>
   <xsl:value-of select="./@Value"/>
  </country>
 </xsl:template>
</xsl:stylesheet>

Regards,
Shailendra

Reply via email to