A
Anthony Harkness-Gripe
This is a very simple XSLT, and I'm doing it ways that I've had work
before, but it's not displaying HTML. Is there a flaw in my logic?
C#:
-------------------------------------------------------------------
// context is current HttpContext
System.Xml.XmlTextWriter xmlw = new
XmlTextWriter(context.Response.Output);
// See XML below for CustomDataSet
XmlDataDocument xmlData = new XmlDataDocument(customDataSet);
XslTransform xslt = new XslTransform();
// Location of file is correct
xslt.Load(@"http://localhost/lender/Testimonial.xslt");
xslt.Transform(xmlData,null,xmlw);
------------------------------------------------------------------
XML (from customDataSet):
------------------------------------------------------------------
<TestimonialData xmlns="http://tempuri.org/TestimonialData.xsd">
<testimonial>
<testimonialid>4</testimonialid>
<siteid>2</siteid>
<body>Hello there</body>
<person>Joe Blow</person>
</testimonial>
</TestimonialData>
------------------------------------------------------------------
Testimonial.xslt
------------------------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/TestimonialData">
<xsl:for-each select="testimonial">
<table>
<tr>
<td>
<xsl:value-of select="body" />
<xsl:value-of select="person" />
</td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------------------------
Actual Output on HTML page (from ASPX):
42Hello thereJoe Blow
It looks like it's not transforming the data at all, just outputting
the XML. Any ideas at all?
Thanks in advance
Anthony
before, but it's not displaying HTML. Is there a flaw in my logic?
C#:
-------------------------------------------------------------------
// context is current HttpContext
System.Xml.XmlTextWriter xmlw = new
XmlTextWriter(context.Response.Output);
// See XML below for CustomDataSet
XmlDataDocument xmlData = new XmlDataDocument(customDataSet);
XslTransform xslt = new XslTransform();
// Location of file is correct
xslt.Load(@"http://localhost/lender/Testimonial.xslt");
xslt.Transform(xmlData,null,xmlw);
------------------------------------------------------------------
XML (from customDataSet):
------------------------------------------------------------------
<TestimonialData xmlns="http://tempuri.org/TestimonialData.xsd">
<testimonial>
<testimonialid>4</testimonialid>
<siteid>2</siteid>
<body>Hello there</body>
<person>Joe Blow</person>
</testimonial>
</TestimonialData>
------------------------------------------------------------------
Testimonial.xslt
------------------------------------------------------------------
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/TestimonialData">
<xsl:for-each select="testimonial">
<table>
<tr>
<td>
<xsl:value-of select="body" />
<xsl:value-of select="person" />
</td>
</tr>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------------------------
Actual Output on HTML page (from ASPX):
42Hello thereJoe Blow
It looks like it's not transforming the data at all, just outputting
the XML. Any ideas at all?
Thanks in advance
Anthony