xsl-list
[Top] [All Lists]

Re: generating dynamic XSL to apply to a single XML document

2003-09-10 09:40:32
Instead you can read the form parameters in the xsl if you are using (say) libxslt and axkit. You just add an xsl:param with the same name as the form parameter and it will get the value filled in if it exists. then use xsl:choose or whatever conditional you prefer and do everything in one xslt stylesheet.

simon

On Wednesday, September 10, 2003, at 03:59 AM, Steven Bethard wrote:

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


--
www.simonwoodside.com :: www.openict.net :: www.semacode.org
                    99% Devil, 1% Angel


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