2 different XSLT on same page

Discussion in 'XML' started by Christoph, Mar 25, 2005.

  1. Christoph

    Christoph Guest

    Can someone point me to a *good* resource (tutorial,
    hopefully) that discusses how to dynamically transform
    XML using different XSL templates on the same page?
    I've got one XSL template to convert the underlying
    XML data to HTML and one to convert it to csv. What
    I'd like to do is allow the end user to switch back and
    forth with simply the click of a link w/o having to reload
    the page.

    thnx,
    Christoph
    Christoph, Mar 25, 2005
    #1
    1. Advertising

  2. Christoph wrote:

    > Can someone point me to a *good* resource (tutorial,
    > hopefully) that discusses how to dynamically transform
    > XML using different XSL templates on the same page?
    > I've got one XSL template to convert the underlying
    > XML data to HTML and one to convert it to csv. What
    > I'd like to do is allow the end user to switch back and
    > forth with simply the click of a link w/o having to reload
    > the page.


    I don't think browsers support that, there is only IE/Win and Mozilla
    that support client-side XSLT but both do not support different
    <?xml-stylesheet?>
    in the same document.
    You would have to use client-side scripting but that needs to be put
    somewhere so you would have a HTML document with script loading the XML
    and the stylesheets and doing the transformation.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Mar 25, 2005
    #2
    1. Advertising

  3. Christoph

    Guest

    Do you mean like this ?

    <HTML>
    <HEAD><SCRIPT>
    function window.onload() {
    output1.outerHTML = EMSXML.transformNode(EMSXSL1.documentElement);
    output2.outerHTML = EMSXML.transformNode(EMSXSL2.documentElement);
    }
    </SCRIPT></HEAD>
    <BODY BGCOLOR="orange" >
    <XML ID="EMSXML" SRC="a.xml"></XML>
    <XML ID="EMSXSL1" SRC="a.xsl"></XML>
    <XML ID="EMSXSL2" SRC="b.xsl"></XML>
    <DIV ID="output1"></DIV>
    <DIV ID="output2"></DIV>
    </BODY>
    </HTML>
    , Mar 25, 2005
    #3
    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. veikoh
    Replies:
    0
    Views:
    462
    veikoh
    Sep 12, 2007
  2. harryajh
    Replies:
    9
    Views:
    633
    harryajh
    Mar 27, 2008
  3. Christopher Brewster
    Replies:
    5
    Views:
    339
    John Machin
    Nov 14, 2008
  4. bluebaron
    Replies:
    3
    Views:
    739
    Jonathan N. Little
    Nov 4, 2009
  5. Guest
    Replies:
    2
    Views:
    179
    Foo Man Chew
    Dec 29, 2003
Loading...

Share This Page