Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Apply multiple stylesheets one at a time to XML source

4 views
Skip to first unread message

Brett Merkey

unread,
Apr 23, 2000, 3:00:00 AM4/23/00
to
One obvious application of stylesheets is to use more than one on the same source.
The purpose would be to display various result trees based on user actions. I am
hoping members of this newsgroup have knowledge of more practical solutions than
mine.

I repurposed :-) the Microsoft xml-xslt viewer script to create an HTML page that
serves as a wrapper to swap out multiple xsl files on the same source.

http://ourworld.compuserve.com/homepages/BWMerkey/xml/index.htm

A good learning project - but clumsy.

1) The swap seems to require the download of the complete file for each
transformation. Definite no-no in the modem world.

2) CSS styling of the HTML result tree has to be done inline. Embedded and external
CSS is somehow killed by the scripting.

It seems that there should be a more elegant implementation of this idea somewhere.
Ultimately, I am not concerned with showing the source. I just want a way to
efficiently show different results from the same source.

--Brett

Michel Hendriksen

unread,
May 2, 2000, 3:00:00 AM5/2/00
to
I didn't look at your URL so I don't know exactly what they are doing there.
But you could put the XML in a data Island and load a different xsl-sheet on
user request (some button or whatever), apply the stylesheet on the xml and
put the result somewhere in a HTML tag (p.e. DIV) using innerHtml... You
only would need to load the requested stylesheet (or preload this: it is xml
and could be in a data Island by itself.

Michel

Brett Merkey <brett_...@tvratings.com> wrote in message
news:#oc$2UTr$GA....@cppssbbsa02.microsoft.com...

Bill DuBay

unread,
May 4, 2000, 3:00:00 AM5/4/00
to
Michel,
That sounds great, but how do you load a different xsl on a loaded xml file?
I only know how to call an xsl file from the xml file.
Thanks in advance!

Michel Hendriksen <mic...@kensas.nl> wrote in message
news:8em8t9$f98$1...@porthos.nl.uu.net...

Michel Hendriksen

unread,
May 9, 2000, 3:00:00 AM5/9/00
to
You could try something like:

<HTML>
</HEAD>
<BODY>

<XML id="data" src="data.xml"></XML>
<XML id="style1" src="some_style1.xsl"></XML>
<XML id="style2" src="some_style2.xsl"></XML>

<div id="result">
</div>

<!-- MAKE SOME BUTTONS -->

<script language="JScript">

function OnButton1( )
{
document.all( "result" ).innerHTML = Transform( "data", "style1" );
}

function OnButton1( )
{
document.all( "result" ).innerHTML = Transform( "data", "style2" );
}

function TransformSelection( XMLsrc, XSLsrc )
{
xmlDoc = document.all( XMLsrc );
xslDoc = document.all( XSLsrc );

xmlRoot = xmlDoc.documentElement;
xslRoot = xslDoc.documentElement;

result_text = xmlRoot.transformNode( xslRoot );

return result_text;
}

</script>
</BODY>
</HTML>

I did not test this, but it would be something like this.

Michel

Bill DuBay <bill_...@phoenix.com> wrote in message
news:sh3o3uk...@corp.supernews.com...

Brett Merkey

unread,
May 13, 2000, 3:00:00 AM5/13/00
to
Michel Hendriksen <mic...@kensas.nl> wrote in message
news:8f9cfe$2r0$1...@porthos.nl.uu.net...

| You could try something like:
<great script snipped here>

Thanks! Your script worked fine. This will give me an excellent alternative way to
display xsl transformations.

Brett


0 new messages