Convert XML to HTML Document

Discussion in 'XML' started by Closer, Nov 4, 2003.

  1. Closer

    Closer Guest

    I am new to XML and XSL, could someone please help?

    I have my XML and XSL files and can view the XML file with the
    stylesheet in my browser. Everything is fine.

    What I want to do is to convert this to an HTML document and when the
    user looks at the source they see HTML instead of XML (which is the
    current source and extention). I want to accomplish this on the
    client side, I tried using the following in an HTML file but again the
    user will not see the desired source.
    <body>
    <script type = "text/javascript">

    //Load XML
    var xml = new ActiveXObject("Microsoft.XMLDOM")
    xml.async = false
    xml.load("note.xml")

    //Load XSL
    var xsl = new ActiveXObject("Microsoft.XMLDOM")
    xsl.async = false
    xsl.load("convert.xsl")

    //Transform
    document.write(xml.transformNode(xsl))


    </script>

    </body>

    In the end I would like to use the XML and XSL files to create a
    single HTML file that I can via e-mail instead of having multiple
    attachments.

    Is this possible?

    Thanks,

    Will
    Closer, Nov 4, 2003
    #1
    1. Advertising

  2. Closer wrote:
    > I have my XML and XSL files and can view the XML file with the
    > stylesheet in my browser. Everything is fine.
    >
    > What I want to do is to convert this to an HTML document and when the
    > user looks at the source they see HTML instead of XML (which is the
    > current source and extention). I want to accomplish this on the
    > client side, I tried using the following in an HTML file but again the
    > user will not see the desired source.
    > <body>
    > <script type = "text/javascript">
    >
    > //Load XML
    > var xml = new ActiveXObject("Microsoft.XMLDOM")
    > xml.async = false
    > xml.load("note.xml")
    >
    > //Load XSL
    > var xsl = new ActiveXObject("Microsoft.XMLDOM")
    > xsl.async = false
    > xsl.load("convert.xsl")
    >
    > //Transform
    > document.write(xml.transformNode(xsl))
    >
    >
    > </script>
    >
    > </body>
    >
    > In the end I would like to use the XML and XSL files to create a
    > single HTML file that I can via e-mail instead of having multiple
    > attachments.
    >
    > Is this possible?


    If you want to have the browser user only see HTML then transform the
    XML on the server and send the HTML result to the browser.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Nov 4, 2003
    #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. Tony Prichard
    Replies:
    0
    Views:
    714
    Tony Prichard
    Dec 12, 2003
  2. Manish Hatwalne
    Replies:
    1
    Views:
    391
    Martin Honnen
    Jul 13, 2004
  3. csgraham74
    Replies:
    2
    Views:
    1,210
    csgraham74
    Sep 19, 2006
  4. elsigh
    Replies:
    3
    Views:
    199
    elsigh
    Jul 23, 2006
  5. icogs
    Replies:
    0
    Views:
    125
    icogs
    Jan 31, 2008
Loading...

Share This Page