I've not played around with this stuff in .Net yet so I was curious so I knocked together the following sample:
XML File to be processed:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<child>
<element att="value">one</element>
</child>
</root>
XSL Transform File:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:my="http://www.wackylabs.net/dotnet"
exclude-result-prefixes="my msxsl">
<xsl:output indent="yes" />
<msxsl:script implements-prefix='my' language='C#'>
<![CDATA[
public XPathNavigator ParseXml(string xml)
{
System.IO.StringReader sr = new System.IO.StringReader(xml);
XPathDocument doc = new XPathDocument(sr);
return doc.CreateNavigator();
}
]]>
</msxsl:script>
<xsl:template match="child">
<child>
<xsl:copy-of select="my:ParseXml(string(.))" />
</child>
</xsl:template>
</xsl:stylesheet>
The output, after running through XslTransform:
Code:
<?xml version="1.0" encoding="utf-8"?>
<child>
<element att="value">text here</element>
</child>
I hope this gives you a good starting point for your own code.
/- Sam Judson : Wrox Technical Editor -/