G
Guest
Hi there,
I create an XML file from a dataset like this:
System.IO.StreamWriter xmlSW = new System.IO.StreamWriter(FILENAME);
dsUserData1.WriteXml(xmlSW, XmlWriteMode.WriteSchema);
xmlSW.Close();
Which gives me this XML file:
<NewDataSet>
<tblUserData>
<User_ID>Administrator</User_ID>
<User_Name>Some Name</User_Name>
<User_Position>Analyst Programmer</User_Position>
<User_Department>Forensic & Special</User_Department>
<User_Phone>03 9632 0872</User_Phone>
<User_Fax>03 9632 0875</User_Fax>
</tblUserData>
</NewDataSet>
Now I convert the XML to an rtf file with the help of a xslt file:
string filename = @"\Inetpub\wwwroot\PersonalData\xml\"+strTmp+".xml";
XslTransform xslt = new XslTransform();
xslt.Load(FILENAME);
XPathDocument xpathdocument = new XPathDocument(filename);
XmlTextWriter writer = new
XmlTextWriter(@"\Inetpub\wwwroot\PersonalData\xml\"+strTmp+".rtf",
System.Text.Encoding.Default);
xslt.Transform(xpathdocument, null, writer, null);
writer.Close();
This is the according XSLT file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl
utput method="text" />
<xsl:template match="/">
<xsl:text>{\rtf1</xsl:text>
<xsl:for-each select="NewDataSet/tblUserData">
<xsl:text>\b </xsl:text>
<xsl:value-of select="User_Name"/>
<xsl:text>\b0 </xsl:text>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Position"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Department"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Phone"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Fax"/>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>
But the problem is that the & is not converted into &.
Some Name
Analyst Programmer
Forensic & Special
03 9632 0872
03 9632 0875
What could be the problem here? I tried using Schema as well, still the same
problem. Please help
Thank you
Chris
I create an XML file from a dataset like this:
System.IO.StreamWriter xmlSW = new System.IO.StreamWriter(FILENAME);
dsUserData1.WriteXml(xmlSW, XmlWriteMode.WriteSchema);
xmlSW.Close();
Which gives me this XML file:
<NewDataSet>
<tblUserData>
<User_ID>Administrator</User_ID>
<User_Name>Some Name</User_Name>
<User_Position>Analyst Programmer</User_Position>
<User_Department>Forensic & Special</User_Department>
<User_Phone>03 9632 0872</User_Phone>
<User_Fax>03 9632 0875</User_Fax>
</tblUserData>
</NewDataSet>
Now I convert the XML to an rtf file with the help of a xslt file:
string filename = @"\Inetpub\wwwroot\PersonalData\xml\"+strTmp+".xml";
XslTransform xslt = new XslTransform();
xslt.Load(FILENAME);
XPathDocument xpathdocument = new XPathDocument(filename);
XmlTextWriter writer = new
XmlTextWriter(@"\Inetpub\wwwroot\PersonalData\xml\"+strTmp+".rtf",
System.Text.Encoding.Default);
xslt.Transform(xpathdocument, null, writer, null);
writer.Close();
This is the according XSLT file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl

<xsl:template match="/">
<xsl:text>{\rtf1</xsl:text>
<xsl:for-each select="NewDataSet/tblUserData">
<xsl:text>\b </xsl:text>
<xsl:value-of select="User_Name"/>
<xsl:text>\b0 </xsl:text>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Position"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Department"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Phone"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Fax"/>
</xsl:for-each>
<xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>
But the problem is that the & is not converted into &.
Some Name
Analyst Programmer
Forensic & Special
03 9632 0872
03 9632 0875
What could be the problem here? I tried using Schema as well, still the same
problem. Please help
Thank you
Chris