2 different XSLT on same page

C

Christoph

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
 
M

Martin Honnen

Christoph said:
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.
 
G

gimme_this_gimme_that

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>
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top