Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Displaying xml document in HTML using XSLT
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
next
Subject:
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
next
Subject:
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>&lt;</xsl:text>
<xsl:value-of select="name()"/>
<xsl:for-each select="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:for-each>
<xsl:text>&gt;</xsl:text>
<!-- recurse -->
<xsl:apply-templates mode="escape"/>
<!-- end tag -->
<xsl:text>&lt;/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>&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.
next
Subject:
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
top
Subject:
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
Prev Topic
Next Topic
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.