日期:2014-05-17 浏览次数:20788 次
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="BOSettings/DataBaseConfig">
<xsl:element name="DataBaseConfig">
<xsl:attribute name="SYS_ID">
<xsl:value-of select="SYS_ID"/>
</xsl:attribute>
<xsl:attribute name="DBType">
<xsl:value-of select="DBType"/>
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
public void Save(string sPath)
{
string xml = ds.GetXml();
XDocument document = XDocument.Parse(xml);
XslCompiledTransform xslTran = new XslCompiledTransform();
xslTran.Load(@"XSLT/template.xslt");
XmlTextWriter writer = new XmlTextWriter(sPath, System.Text.Encoding.UTF8);
xslTran.Transform(document.CreateReader(), writer);
writer.Close();
}