embedding XML in HTML

S

shea

I have an XML data type which I would like to display in my HTML.
The data type looks somthing like this:

<package name="helloworld">
<description>
This is a program which prints hello world to a terminal.
</description>
<file uri="hellos.zip" name="source code" size="100bytes"/>
<file uri="hellob.zip" name="binaries" size="300bytes"/>
<package>

I would like to embed these <packages> at various location in my
formatted text (html). Then use XSLT's to do the transforms.

I have used XSLT's which XML only documents before, but I am not sure
how to get started doing it in a mixed mode file.

What is the simplest way to acomplish this.

~S
 
M

Martin Honnen

shea said:
I have an XML data type which I would like to display in my HTML.
The data type looks somthing like this:

<package name="helloworld">
<description>
This is a program which prints hello world to a terminal.
</description>
<file uri="hellos.zip" name="source code" size="100bytes"/>
<file uri="hellob.zip" name="binaries" size="300bytes"/>
<package>

I would like to embed these <packages> at various location in my
formatted text (html). Then use XSLT's to do the transforms.

I have used XSLT's which XML only documents before, but I am not sure
how to get started doing it in a mixed mode file.

What is the simplest way to acomplish this.

Well, in theory the proper way to mix your XML data markup with your
HTML document markup is to use XHTML and then embed your XML data in a
separate namespace. Then you can write an XSLT transformation which is
namespace aware and does an identity transformation on the elements in
the XHTML namespace and transforms your XML data to the XHTML markup you
want the data rendered with.
In practice you might encounter problems if you can't use XHTML instead
of HTML as your input and you might encounter problems with XHTML output
as browsers like IE are not yet up to deal with real XHTML. But the last
problem is easily solved with XSLT as that also allows you to transform
XHTML to plain HTML so that is not such a big deal.
What remains is your HTML input and whether you want/can transform that
to XHTML. Tidy is a tool that can help with that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Embedding HTML in XML 2
Embed HTML in XML 4
new at xml 4
html in xml 2
XML/XHTML/HTML differences, bugs... and howto 0
xml to html 6
embedding schema in the xml document.. 3
XML/XSL output to multiple HTML files 2

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top