473,657 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embed HTML in XML

Ok - i was wondering if someone could help me.

im basically trying to embed an html string in piece of XML. i
created an xsl and added the CDATA into the xml around the html i wish
to render. In my calling page i create an XML data island (excuse the
terminology as im new to this stuff) to pull in the xml fields and
to hopefully render the html as xml (see Details node ) .
Unfortunately this doesnt work and it just displays as a string
output.

If anyone could give me some assistnace on this it would be a great
help, if im totally barking up the wrong tree please tell me.

the only thing i must say is that i need to creata HTML inside the XML
node as im using a third party control to create this.

My current output is a table with all fields pulling in corrctly
except the details node.

Any help on this appreciated.

XML DATA ISLAND
<xml id="cdcat" src="/experience/includes/test.xml"></xml>
<table border="1" datasrc="#cdcat ">

<tr>
<td><span datafld="Title" ></span></td>
<td><span datafld="Date"> </span></td>
<td><span datafld="Info"> </span></td>
<td><span datafld="Detail s"></span></td>
</tr>

XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="style.xsl "?>
<Data>
<Title>Test 1</Title>
<Date>20th June 2007</Date>
<Info>ghsdgfhsd gfh fdsfhjsdfhjh fsdfjhsdfjhhfjh fhsjdfhjshdfjhj
sjdfhjsdhfjhj fhjshdfsdj jdfhjhsdfhhfhsf </Info>
<Details><!
[CDATA[<P>xxxxx<BR>hfs jdhjsdfh<BR><BR >sdfjksjdfkksfj <BR><BR>sdfjmsd fsdfj<BR><BR><B R>sdfjskjdfkjsk jfksj<BR></
P>]]></Details>
</Data>

XSL

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="Details" >
<xsl:value-of select="//Data/Details" disable-output-escaping="yes"/
>
</xsl:template>
</xsl:stylesheet>

Jun 13 '07 #1
4 4271
csgraham74 wrote:
Ok - i was wondering if someone could help me.

im basically trying to embed an html string in piece of XML. i
created an xsl and added the CDATA into the xml around the html i wish
to render.
Don't. Leave it as normal markup and add suitable templates to your XSL
to handle it.

See the FAQ: http://xml.silmaril.ie/authors/html/

XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="style.xsl "?>
<Data>
<Title>Test 1</Title>
<Date>20th June 2007</Date>
<Info>ghsdgfhsd gfh fdsfhjsdfhjh fsdfjhsdfjhhfjh fhsjdfhjshdfjhj
sjdfhjsdhfjhj fhjshdfsdj jdfhjhsdfhhfhsf </Info>
<Details>
<P>xxxxx<BR/>hfsjdhjsdfh< BR/>
<BR/>sdfjksjdfkksfj <BR/>
<BR/>sdfjmsdfsdfj<B R/>
<BR/><BR/>sdfjskjdfkjskj fksj<BR/></P>
</Details>
</Data>

then

XSL

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">

<xsl:template match="Details" >
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

///Peter

Jun 14 '07 #2
thanks peter - i really appreciate the help

i have created the following template and it displays the xml
correctly when i open my .xml document in my browser.

However when i try to embed this in html it still displays as before -
why is this happening ?? can i apply my style from with my HTML
document ????

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="Details" >
<p>
<xsl:apply-templates select="Details "/>
</p>
</xsl:template>
<xsl:template match="Details" >
<xsl:value-of select="//Data/Details" disable-output-escaping="yes"/
>
</xsl:template>
</xsl:stylesheet>

it

Jun 14 '07 #3
On 13 Jun, 18:29, csgraham74 <csgraha...@gma il.comwrote:
im basically trying to embed an html string in piece of XML.
Looks more like you're having trouble putting XML into HTML.
i create an XML data island
An obsolete and non standards-based M$oft technique that's best
avoided. Look at the AJAX route, not "data islands".

If embedding HTML inside your XML is also a problem, then look at how
RSS does it (mainly by encoding "<" as "&lt;" etc.). There's a
famously good web page out there on "diveintoma rk" called "The myth of
RSS version compatibility".

Jun 14 '07 #4
Peter Flynn wrote:
csgraham74 wrote:
>Ok - i was wondering if someone could help me.

im basically trying to embed an html string in piece of XML. i
created an xsl and added the CDATA into the xml around the html i wish
to render.

Don't. Leave it as normal markup and add suitable templates to your XSL
to handle it.
This was exactly what I was looking for but had not yet taken the time
to create a clean posting. Thank you.

I needed to add the namespace for XHTML to get it to work for me. Here
is a fragment from one my XML files where the <pretexteleme nt may
include XHTML content.

<equipment xmlns="http://emle.sourceforg e.net/emle020100"
xmlns:xhtml="ht tp://www.w3.org/1999/xhtml">
<id>3</id>
<title>Solid Rectangle Fraction</title>
<value>
<pretext>
<xhtml:em>Unseg mented</xhtml:emrectang le selectable by the
enclosed buttons.
</pretext>

Here is a slightly edited fragment from the XSLT file that passes the
XHTML content within <pretextto the output file:

<xsl:template match="emle:val ue">
<div class="emleValu e">
<div class="emlePreT ext"><xsl:copy-of select="emle:pr etext" /></div>
<xsl:apply-templates
select="emle:co ntrol|emle:cons tant|emle:graph ic" />
<div class="emlePost Text">
<xsl:copy-of select="emle:po sttext" /></div>
</div>
</xsl:template>

The complete files are here:

http://emle.sourceforge.net/emle0201...le_lab_011.xml
http://emle.sourceforge.net/emle020100/emle_lab_011.xsl
http://emle.sourceforge.net/emle0201...quipment_3.xml

I am using "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4)
Gecko/20070515 Firefox/2.0.0.4" which may be needed for the pages to
display.

--
C.W.Holeman II | cw***@Julian5Lo cals.com-5 http://JulianLocals.com/cwhii
To only a fraction of the human race does God give the privilege of
earning one's bread doing what one would have gladly pursued free, for
passion. I am very thankful. The Mythical Man-Month Epilogue/F.P.Brooks
Jun 14 '07 #5

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

Similar topics

1
2794
by: Failure | last post by:
I want to embed html in my xml document. What tag must I use to prevent the parser from parsing the html? TIA!
11
4489
by: Anna | last post by:
Hi all. I want to embed the EMBED tag in the object tag. I understood that I need to provide a PARAM tag inside the OBJECT whose value will hold the content of EMBED src attribute, but after that I've got confused. For example, what should be put into classid and codebase attributes of the OBJECT now embedding the EMBED tag?
2
3091
by: Cris Curtis | last post by:
When I use an embed tag that uses a dynamic aspx page, the dynamic aspx page appears to get called 2 times instead. Below is code that adds an embed tag to a placeholder control that will use a second aspx page to generate the svg for the embed. svgchart.Controls.Clear(); string strSRC = "./DesktopModules/Enterprise/BusinessRuleSVG.aspx";
24
6254
by: Manuel | last post by:
Is it possible to embed an image, like a company logo in a CDOSYS generated message? If yes, I´ll apreciate some code sample. I´ve been able to format messages in html the way I like, but I can't figure out how to embed an image. Thanks for your time. -- Manuel
1
2974
by: Andrew Poulos | last post by:
With "normal" SWF HTML there's an EMBED tag nested within an OBJECT tag. How can I check which tag is actually displaying the SWF? I'm using CSS on them and the style on the OBJECT affects the EMBED tag so I'm going to use some code to correct it but I can't tell which tag is responsible for the display. Andrew Poulos
6
2372
by: qualitychecker | last post by:
Hello thanks for your help.. I try to reference a PHP module from within a HTML file, see below ---------------------------------------- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"> <head> <titleMy title </title> </head> <body> on place un embed <embed id="embed1" alt="ne marche pas..." src="ws.php?
13
3027
by: Ben Sharvy | last post by:
I'd like to bring a page into HTML 4 compliance, but I can't understand the information about the <OBJECTtag that I read at help sites. I have this in a page: <embed src="soundfile.mov" autostart="true" loop="false" hidden="true"</embed> How do I accomplish that effect in an HTML 4 compliant way?
2
4326
polymorphic
by: polymorphic | last post by:
I am no longer good at Javascript and need help. I'm trying to embed pdf files in html then build some sort of navigation between the pdfs via the pdf numbered file name. I can generate the javascript functions to extract and manipulate strings, ints, etc but can't seem to deal with the variables I produce. For instance, if current embedded pdf filename is "1.pdf" and button "Next" is clicked then embed "2.pdf". I cannot seem to get the...
0
1782
by: howa | last post by:
Consider a simple HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>YUI</title> <link rel="stylesheet" href="http://yui.yahooapis.com/2.5.1/build/ reset-fonts-grids/reset-fonts-grids.css" type="text/css"> </head>
2
8069
dream party
by: dream party | last post by:
Inserting a Flash (SWF, FLV) file into HTML web page is already an old and familiar thing to all of us. It is a rather non-flexible thing that just to edit some options in the template. However, I did not understand some parameters totally in the HTML tag. These days when I was surfing the Internet I have found some comprehensive introduction to these two tags. I read it and conclude it with my own words; I think it will be useful to us, so I...
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8845
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8622
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.