473,467 Members | 1,586 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Displaying embedded html from an xml file through an xsl stylesheet

Hi chaps

I've got an XML file, within that file i've embedded html code using
the
<![CDATA[ ]]>
tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc

How can i tell my xml file to display the html tags as html and not
display them as text?

Many thanks
Jul 20 '05 #1
2 2824
"Joe Price" <jo*****@hotmail.com> wrote in message
news:e0**************************@posting.google.c om
I've got an XML file, within that file i've embedded html code using
the <![CDATA[ ]]> tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc


Sure, because the XSL Processor correctly escapes these tags, so they do
not lose their (in this case textual) meaning in HTML.
What you have to do is prevent this process called "output-escaping"
from happening.

When you have
<native>
<![CDATA[<p>Hallo</p><br><b>test</b>]]>
</native>

then this does the trick:
<xsl:template match="native">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>

HTH Martin
Jul 20 '05 #2
cheers bud, worked a treat
"Martin Boehm" <ng********@arcor.de> wrote in message news:<3f***********************@newsread2.arcor-online.net>...
"Joe Price" <jo*****@hotmail.com> wrote in message
news:e0**************************@posting.google.c om
I've got an XML file, within that file i've embedded html code using
the <![CDATA[ ]]> tag

I'm displaying that xml file through a browser using an xsl style
sheet. However it is displaying any html from the xml file as text,
ie its displaying as text <br/> and <b> etc


Sure, because the XSL Processor correctly escapes these tags, so they do
not lose their (in this case textual) meaning in HTML.
What you have to do is prevent this process called "output-escaping"
from happening.

When you have
<native>
<![CDATA[<p>Hallo</p><br><b>test</b>]]>
</native>

then this does the trick:
<xsl:template match="native">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:template>

HTH Martin

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry Anderberg | last post by:
I have an XML document that I am trying to display in my ASP.NET page. I am using an XSL Transform to display repeating XML data in a specific format. It reads the data, and displays it on my...
4
by: Stephen | last post by:
I have an xml document with a xsl stylesheet. It will display the styles in explorer, but not in netscape 7.1 <?xml version="1.0" standalone="no"?> <!DOCTYPE home SYSTEM...
3
by: RD | last post by:
My app transmits XML data file via e-mail and for now I attach both the XML data file and the corresponding style sheet. I found however that whenthe recipient double clicks on the XML file to read...
0
by: Anthony Harkness-Gripe | last post by:
This is a very simple XSLT, and I'm doing it ways that I've had work before, but it's not displaying HTML. Is there a flaw in my logic? C#:...
5
by: nutsmuggler | last post by:
Hi. I am using xml to store my annotations. here is my document (a part of it): <?xml version="1.0" encoding="UTF-8"?> <text title="Finnegan's wake"> <book number="1"> <chapter number="5">...
4
by: dcrackel | last post by:
I hope there is a simple solution to this, but I've been unable to find it. $dom = new DomDocument(); $dom->load("test.xml"); $test = $dom->getElementsByTagName("test"); $test->nodeValue =...
3
by: hestres | last post by:
Hello, I'm working on some link styles for this page: http://www.house.gov/velazquez/lh0205tres/reports.html I want all the links to always display in red (#CC0000), but in IE6 and 7 they...
1
by: erictomlinson | last post by:
I'm dying here trying to figure this out for days. Here's the scenario: 1) External script.as file dynamically imported to loader.swf file that creates a textfield (createTextField) 2)...
3
by: mikec87 | last post by:
I am very new with PHP...started doing this a few days ago to help someone and I need some help please. I have a webpage that is not displaying the records I want it to. The sql is correct, and I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.