Re: [xsl] generating dynamic XSL to apply to a single XML document

Subject: Re: [xsl] generating dynamic XSL to apply to a single XML document
From: r.devries@xxxxxxxx
Date: Wed, 10 Sep 2003 10:05:23 +0200
Hi Steven,

Maybe this helps. I took it from MS MSXML 4.0 SDK help:

The following Microsoft® JScript® example fills an HTML DIV tag with the
result of transformNode.

<SCRIPT>
  // Load data.
  var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
  source.async = false;
  source.load("books.xml");

  // Load style sheet.
  var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
  stylesheet.async = false
  stylesheet.load("sample.xsl");

  // Fill a div tag with the result of the transform
  divInfo.innerHTML = source.transformNode(stylesheet);
</SCRIPT>

If you want to fill the complete windows, you cab change de last line of
the script into:
document.write(source.transformNode(stylesheet))

Greetings René
   {@   @}
        ^
      \_/

"You don't need eyes to see, you need vision!"

TJIP PCL
Steenovenweg 3
5708 HN  Helmond
The Netherlands
tel: +31(0) 492 502 222
fax: +31(0) 492 502 299
e-mail: R.deVries@xxxxxxxx
internet: www.tjip.com

***************************DISCLAIMER********************************
Deze e-mail is uitsluitend bestemd voor de geadresseerde(n).
Verstrekking aan en gebruik door anderen is niet toegestaan.
TJIP PCL sluit iedere aansprakelijkheid uit die voortvloeit uit
elektronische verzending.

This e-mail is intended exclusively for the addressee(s), and may
not be passed on to, or made available for use by any person
other than the addressee(s). TJIP PCL rules out any and every liability
resulting from any electronic transmission.


                                                                                                                                        
                    "Steven Bethard"                                                                                                    
                    <bediviere@xxxxxxxxxxx>            To:     <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>                                        
                    Sent by:                           cc:                                                                              
                    owner-xsl-list@xxxxxxxxxxxx        Subject:     [xsl] generating dynamic XSL to apply to a single XML document      
                    rytech.com                                                                                                          
                                                                                                                                        
                                                                                                                                        
                    10-09-2003 09:59                                                                                                    
                    Please respond to xsl-list                                                                                          
                                                                                                                                        
                                                                                                                                        




I have a single XML document that contains the data.  There are several
different views of this data that I need to display, and exactly what
goes into a view will be determined by some selections in an HTML form.
So my plan had been to incorporate a CGI script that would take the form
parameters, generate the appropriate XSL stylesheet, and format the XML
document using this stylesheet.

The only way I know to apply a different XSL stylesheet to the same XML
document is something like:
<?xml version="1.0"?>
<!DOCTYPE page [
<!ENTITY data SYSTEM "data.xml">
]>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<page>
&data;
</page>
which (I believe) would mean I would have to save a file called
"style.xsl", and then have the CGI script return the above as xml data.

I'd rather not create a bunch of temporary files (for the "style.xsl"
files) if I can avoid it. Is there a better way to do this?

Steve


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread