My output from this transformation only includes the text, but I want the HTML and text output. What do I need to change to do that?
I'm using VS 2010
current example output:
Jones Martin Kelley Marshall
Note I have this in the xsl too, but it wasn't showing in my code example:
xsl:output
standalone="no"
method="xml"
indent="yes"
omit-xml-declaration="no"
version="1.0"
xsl:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="/people">
<div class="lastnames">
<ul>
<li>
<xsl:value-of select="lastname" disable-output-escaping="yes" />
</li>
</ul>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
C#:
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load(xslPath);
using (XmlWriter writer = XmlWriter.Create(outPath +
fileName +
"." +
fileExt
, xslt.OutputSettings))
{
xslt.Transform(fileNode, null, writer);
writer.Flush();
writer.Close();
}
This simple transformation:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="people">
<div class="lastnames">
<ul>
<xsl:apply-templates/>
</ul>
</div>
</xsl:template>
<xsl:template match="lastname">
<li><xsl:apply-templates/></li>
</xsl:template>
</xsl:stylesheet>
when applied on this XML document (non has been provided !!!):
<people>
<lastname>Jones</lastname>
<lastname>Martin</lastname>
<lastname>Kelley</lastname>
<lastname>Marshall</lastname>
</people>
produces the wanted, correct result:
<div class="lastnames">
<ul>
<li>Jones</li>
<li>Martin</li>
<li>Kelley</li>
<li>Marshall</li>
</ul>
</div>
And it is displayed by the browser as expected: