Subject: Re: [xsl] Passing parameter from a form From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Thu, 9 Aug 2001 18:26:03 +0100 |
Hi Doug, > Another challenging question! I have a web page which contains a > glossary, which has many categories. I want to give the user the > option of viewing all items or by category. I also want to give the > option of the output being in HTML or PDF format. The user would use > a simple form from a XSL stylesheet to deterimine the output. The > form component of the stylesheet is below. Parameters are really simple to use with Cocoon, so I'd stick with just using that rather than doing anything fiddly with ASP. You need to have a stylesheet that accepts parameters, so it will look something like: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="sorting" select="'All'" /> <xsl:param name="output" /> ... </xsl:stylesheet> Now you can pass parameters into the stylesheet by including them in the URL, which is what will happen naturally if you submit the form. Set the action of the form to the XML document that you want to transform (e.g. categories.xml), so the URL that you things like: categories.xml?sorting=All&output=PDF The categories.xml document needs to have an xml-stylesheet processing instruction that points to the stylesheet, and a cocoon-process processing instruction to tell Cocoon to process the XML with XSLT. In the stylesheet you can print out the values of the two parameters with something like: Sorting: <xsl:value-of select="$sorting" /> Output: <xsl:value-of select="$output" /> Of course using those parameters (especially $output) is another matter, but this should get you on track, hopefully. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Passing parameter from a form, Hewko, Doug | Thread | [xsl] A unique distinct problem, Nate |
RE: [xsl] Caching source documents , Michael Kay | Date | RE: [xsl] Localised string processi, Joerg Pietschmann |
Month |