RE: [xsl] Trying to read a parameter in the request in a XSL file

Subject: RE: [xsl] Trying to read a parameter in the request in a XSL file
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Fri, 3 Oct 2003 17:07:10 -0500
Anthony,

> When you first go to http://localhost:8100/cocoon/test.xml at first, only
> the Level1 tag will be shown. (Utility as a link)
> Now, when you click on Utility (This is the link >>
> http://localhost:8100/cocoon/test.xml?L1=util for Utility)
> You will still be on test.xml, but in my XSL, I want to take the L1
> parameter, and be able to display the Level2's below it.

In answer to the question in the subject line,
in order for an XSL stylesheet to read request parameters in cocoon,
you have to set up the sitemap to make that possible.
You can do this a few different ways. The easiest is:

1) In your map:transform element, use use-request-parameters:

  <map:transform src="foo.xsl">
    <map:parameter name="use-request-parameters" value="true" />
  </map:transform>

(assuming your default transformer is XSLT)

Then every request parameter, such as L1 in your example, will
be passed to the parameter in the stylesheet of the same name,
e.g. <xsl:param name="L1" />
And when you reference the param as "$L1" in your stylesheet,
the value will be 'util'.

See also http://www.cocooncenter.de/articles/request-params/transformer.html
for a slightly different way to do this.

HTH,
Lars

(If you reply to this message and want me to see your reply, please
cc: me directly.)


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


Current Thread