Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use HTML inside an XML and transform using XSL

Status
Not open for further replies.

RGeo

Programmer
Aug 26, 2001
4
IN
I have this xml generated from ASP with values from a database as follows:
<?xml version=&quot;1.0&quot;?>
<report>
<row>
<column><caption>ID</caption>
<value>1</value>
</column>
<column><caption>Notes</caption>
<value>Approvedby <FONT COLOR=&quot;RED&quot;><B>ABC</B></FONT></value>
</column>
</row>
</report>

One of the column elements has html embedded in it. When transformed with XSL, i need to see the HTML formatting on the page but the FONT and Bold tags appear as it is.

The xsl i use is sthg like this
<?xml version=&quot;1.0&quot;?>
<xsl:stylesheet xmlns:xsl=&quot; <xsl:template match=&quot;/&quot;>
<xsl:for-each select=&quot;report&quot;>
<table>
<xsl:for-each select=&quot;row&quot;>
<tr>
<xsl:for-each select=&quot;column&quot;>
<td><xsl:value-of select=&quot;value&quot;/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

What should i do to see effect of the HTML formatting. I tried using xsl:eek:utput and xsl:text with the disable-output-escaping option set to yes , but i get the error &quot;Keyword xsl:text/xsl:eek:utput may not be used here.&quot;

Thanks
Rachel
 
Hello Rachel,

If you try the xsl file like the following, it should work.

<?xml version=&quot;1.0&quot;?>
<xsl:stylesheet
version=&quot;1.0&quot;
xmlns:xsl=&quot;
<xsl:eek:utput method=&quot;xml&quot; indent=&quot;yes&quot;/>
<xsl:template match=&quot;/&quot;>
<xsl:for-each select=&quot;report&quot;>
<table>
<xsl:for-each select=&quot;row&quot;>
<tr>
<xsl:for-each select=&quot;column&quot;>
<td><xsl:copy-of select=&quot;value&quot;/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Good luck

Henry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top