In order to get the example below to work I had to pass URL parameters as foo='bar' rather than the standard foo=bar.
This strikes me as sort of odd behaviour. I think I understand why I need to do this, but *should* I need to? On Mon, 19 Nov 2001, Kip Hampton wrote: > > > Gavin Carr wrote: > > > > Hi all, > > > > I'm sure this must be a FAQ, but I haven't been able to find anything in > > the docs. Is there a way of passing and referencing query parameters > > within a (XSLT) stylesheet in axkit? I've found StyleChooser::QueryString, > > but I want to modify the behaviour of the stylesheet rather than just > > choose a different one. > > URL parameters and POST'd form fields are passed through by the > AxKit::Language::<yourXSLTproc> modules by default* and are available > from within the XSLT stylesheet via the <xsl:param> element: > > <?xml version="1.0"?> > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:param name="mood"/> > <xsl:param name="animal"/> > <xsl:template match="/"> > <page> > <p> > Ah, I see that your > <xsl:value-of select="$animal"/> > is > <xsl:value-of select="$mood"/>. > </p> > </page> > </xsl:template> > </xsl:stylesheet> > > A request using these URL parameters: > http://mycoolaxkitsite.com/demo.xml?mood=cheerful;animal=dahut > > yields: > <page> > <p> > Ah, I see that your dahut is cheerful. > </p> > </page> > > If you want to set a default value for the parameter, you can do that, > too. > > If the default values is a plain string, add it as a text() child to the > <xsl:param>: > > <xsl:param name="animal">Mystery Beast</xsl:param> > > or, to fallback to a value contained in the XML document that is being > processed, do: > <xsl:param name="myParam" select="/path/to/fallback/value"/> > > * Note: the current policy of passing URL params and form fields through > to the stylesheets always, by default, may be changed to a configuration > option that you have to explicitly switch "on" in future releases. > (Well, at least I remember some discussion about it... somewhere... :-) > > HTH, > -kip > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
