Hi Ben,
yep the sort tag is wrong, because $sort is a string rather than a nodeset. You'll need to make your sort tag something like:
<xsl:sort select="*[name(.) = $sort]"/>
I think that should work.
Adam
Ben Pope wrote:
Hi Adam,
Thanks for the reply.
I changed the sitemap (That looks pretty close to another variation I tried).
My output.xsl Already had <xsl:param name="sort"/>
But it still didn't work.
Then I reordered some stuff to what you suggested (don't know if you meant for me to re-order it)
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:param name="sort"/>
Became
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="sort"/> <xsl:template match="/">
And it now says: "Reports - sort order = date." Or "Reports - sort order = number."
So <xsl:value-of select="$sort"/> works nicely.
You star!
So is it best to have use-request-parameters set to false and pass the single parameter in (in terms of ability to cache the form)? I guess it can use the cached version if that one parameter remains constant, rather then the whole set of parameters?
One problem persists:
It still doesn't actually sort the table.
<xsl:for-each select="data/reports/*"> <xsl:sort select="$sort"/> <!-- blah --> </xsl:for-each>
Is my <xsl:sort /> tag correct? (I presume not).
Thank you again, I am at least a lot closer.
Ben.
-----Original Message-----
From: Adam Walsh [mailto:[EMAIL PROTECTED] Sent: 19 July 2004 00:48
To: [EMAIL PROTECTED]
Subject: Re: Request Parameters in XSLT (Cocoon 2.1.5)
Hi Ben,
I'd suggest the following:
Sitemap.xmap:
<map:match pattern="output"> <map:generate src="input.xml" type="file"/> <map:transform src="output.xsl" type="xslt"> <map:parameter name="sort" value="{request-param:sort}" /> </map:transform> <map:serialize/> </map:match>
and make sure in your output.xsl you have <xsl:param name="sort"/>, ie:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="sort"/>
<xsl:template match="/"> ... </xsl:template> </xsl:stylesheet>
Hope that helps.
Adam
--------------------------------------------------------------------- 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]