XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Prakash DesaiSubject: Displaying xml document in HTML using XSLT
Author: Prakash Desai
Date: 26 Oct 2006 11:10 AM
Hi,

I am wrting xslt which creates html document using xslt and i want to put part of the document in html for viewing.

I use something like this

<td>
<b>Message:</b>
<pre style="font-family:arial,helvetica,sans-serif; font-size:8pt; color:#000000;">
<xsl:copy-of select="//listingEvent"/>
</pre>
</td>

it does put the part of xml document in html but it does not escape < and > characters and i am not able to see the tag in html.

Can anyone please help me so that i can escape characters in output so i can view xml in html document along with other infomation.

Any help or different solution will be appreciated.

Thanks in advance.

PJD

Postnext
James DurningSubject: Displaying xml document in HTML using XSLT
Author: James Durning
Date: 27 Oct 2006 02:07 PM
You will not be able to output the xml as actual tags then eg, with the < and >. I suggest a recursive style template, something like:

<xsl:apply-templates mode="escape"/>

<xsl:template match="*" mode="escape">
<xsl:text>&amp;lt;</xsl:text>
<xsl:value-of select="name()"/>
<xsl:for-each select="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>=&quot;</xsl:text>
<xsl:value-of select="."/>
<xsl:text>&quot;</xsl:text>
</xsl:for-each>
<xsl:text>&amp;gt;</xsl:text>
<!-- recurse -->
<xsl:apply-templates mode="escape"/>
<!-- end tag -->
<xsl:text>&amp;lt;/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>&amp;gt;</xsl:text>
</xsl:template>

This doesn't cover everything, (eg processing instructions or comments) but I'm not sure how much you want to output as tags.

Postnext
Prakash DesaiSubject: Displaying xml document in HTML using XSLT
Author: Prakash Desai
Date: 27 Oct 2006 08:28 PM
Thank you very much for the reply. I will definately try and let you know. I guess this should be enough and covers what i need.

Thanks.
pjd

Posttop
Prakash DesaiSubject: Displaying xml document in HTML using XSLT
Author: Prakash Desai
Date: 30 Oct 2006 01:46 PM
I tried this and its working fine.

Thanks for your help.

pjd

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.