Altova Mailing List Archives


RE: [xsl] XML allowing variable XSL application for browsers?

From: "Aron Bock" <aronbock@----------->
To:
Date: 4/21/2005 5:49:00 AM
John, here's one way to approach this:



1) send the browser an HTML document, with an embedded XML data island, and 
multiple XSL islands, each corresponding to a transform.  They need not be 
"embedded", but in many cases I prefer this.



2) in the body-load event, use client-side [java]script to apply one of the 
XSLs to the XML and display



3) at server or client build a dropdown of other transforms ("views"); each 
corresponds to an XSL island; when selected use script to apply the 
corresponding XSL to the XML and redisplay.  All this happens without a 
server round-trip.



See this link for starters: http://xmlfiles.com/xsl/xsl_client.asp .  Also 
look into "Sarissa", which has been mentioned on this NG as a cross-browser 
XML-related script library.



Regards,



--A







From: John <john-xsl-list@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] XML allowing variable XSL application for browsers?
Date: Wed, 20 Apr 2005 14:14:51 -0700

I have an XML file on a web server which references an XSL with code as 
follows:



<?xml-stylesheet type="text/xsl" href="somefile.xsl"?>



When IE or Firefox requests this XML file, the browser detects the 
stylesheet reference and applies it to the XML to transform it into HTML.  
This works great, but what if I want to let the user choose from multiple 
XSL files which can be applied to the same XML?  My first thought was URL 
parameters (which I otherwise generally avoid), but I am not sure if there 
is any URL parameter that can override the stylesheet referenced in the XML 
file.  I was then thinking multiple XML files that basically contain the 
XSL reference and an entity reference (keeping the XML in a separate file), 
or using document() in the XSL files to open the content XML, but I would 
prefer to avoid that if possible.



Does anyone have any recommendations, pros and cons of the various 
techniques?



Thanks & regards,



   -John




_________________________________________________________________

Is your PC infected? Get a FREE online computer virus scan from McAfee. 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.