XML Transformation Trouble...
Hi all,
Currently I am working on a template solution which transforms contents of a given section (which is in a xml format) with the help of preset XLST files assigned to those sections. The code goes something like this
/Default.aspx
.
.
.
.
// Get the sections data in XML format
string xmlData = DataLoader.GetSectionData(sectionName, sectionPath, articleId, pageNumber );
// Get that sections template file
string xslFile = Server.MapPath("/")+"Files\\Templates\\"+ templateFile +"\\Default.xsl";
System.IO.StringReader sr = new System.IO.StringReader(xmlData);
XPathDocument doc = new XPathDocument(sr);
XslTransform trans = new XslTransform();
trans.Load(xslFile);
//Transform it and output as HTML
XmlTextWriter writer = new XmlTextWriter(Response.Output);
writer.Formatting = Formatting.None;
trans.Transform(doc,null,writer);
/SectionData.xml
<Root>
<Article>
<Title>Wonders of life</Title>
<Content>
<!--
[u]Sometimes[u], you wonder how a particular thing went wrong; < b>but most of the time</ b> you wonder how it worked at all
-->
</Content>
</Article></Root>
/SectionTemplate.xslt
.
.
.
<xsl:value-of select="/Root/Article/Title" />
<br />
<xsl:value-of select="/Root/Article/Content/comment()" disable-output-escaping="yes" />
.
.
.
What i expected of the tranformer was to spit the contents of the comment tag to the browser without any parsing/escaping so the html formatting of the given article can be maintained, but whatever is done (I even tried with copy-of xsl element to no effect) the output I get is like this in the article page (HTML VIEW of the generated code)
Wonders of life<br />
<u>Sometimes<u>, you wonder how a particular thing went wrong; <b>but most of the time</b> you wonder how it worked at all
Any help would be appreciated, Thanking you
CreProDes
|