embedding XML in HTML

Discussion in 'XML' started by shea, May 25, 2004.

  1. shea

    shea Guest

    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
    shea, May 25, 2004
    #1
    1. Advertising

  2. shea wrote:

    > 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.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, May 26, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin
    Replies:
    1
    Views:
    497
    Martin Honnen
    Dec 17, 2003
  2. Mark Van Orman

    embedding xml in xml as non-xml :)

    Mark Van Orman, Sep 14, 2004, in forum: XML
    Replies:
    5
    Views:
    476
    Patrick TJ McPhee
    Sep 15, 2004
  3. Replies:
    1
    Views:
    585
    Travis Newbury
    Sep 13, 2006
  4. DartGuru
    Replies:
    4
    Views:
    2,699
    Chaddy2222
    Oct 23, 2007
  5. Replies:
    5
    Views:
    545
Loading...

Share This Page