G
Grep J
Hello,
I'm using Visual Studio.NET 2003 and I'm wondering that
is it possible to call XSL file's template to transform a XML file?
I have following files.
A XML file below
<?xml version="1.0" encoding="UTF-8"?>
<MODEL>
<Charge id="1">ABC</Charge>
<Charge id="2">DEF</Charge>
</MODEL>
and XLS file below containing two XSL templates, TempalteA and TemplateB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- This is template "block" 1 -->
<xsl:template match='TemplateA'>
<table border="1">
<xsl:for-each select="Charge">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<!-- This is template "block" 2 -->
<xsl:template match='TemplateB'>
<table border="1">
<xsl:for-each select="Charge">
<tr bgcolor="#0000FF">
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
So, it it possible in C# to ask certain XML/XSL classes to transform
XML file above using e.g. XSL file's TemplateB?
I have had tried classes like XPathDocument, XslTransform and
XPathNavigator
but haven't succeeded. Can anyone please help?
Cheer,
I'm using Visual Studio.NET 2003 and I'm wondering that
is it possible to call XSL file's template to transform a XML file?
I have following files.
A XML file below
<?xml version="1.0" encoding="UTF-8"?>
<MODEL>
<Charge id="1">ABC</Charge>
<Charge id="2">DEF</Charge>
</MODEL>
and XLS file below containing two XSL templates, TempalteA and TemplateB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- This is template "block" 1 -->
<xsl:template match='TemplateA'>
<table border="1">
<xsl:for-each select="Charge">
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<!-- This is template "block" 2 -->
<xsl:template match='TemplateB'>
<table border="1">
<xsl:for-each select="Charge">
<tr bgcolor="#0000FF">
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
So, it it possible in C# to ask certain XML/XSL classes to transform
XML file above using e.g. XSL file's TemplateB?
I have had tried classes like XPathDocument, XslTransform and
XPathNavigator
but haven't succeeded. Can anyone please help?
Cheer,