This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Passing parameter from a form


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]