[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Passing parameter from a form

Subject: Re: Passing parameter from a form
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 9 Aug 2001 18:26:03 +0100
pass parameter to xml
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.