cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Pope" <nos...@hotmail.com>
Subject RE: Request Parameters in XSLT (Cocoon 2.1.5)
Date Mon, 19 Jul 2004 00:43:53 GMT
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:awalsh@contal.net.au] 
Sent: 19 July 2004 00:48
To: users@cocoon.apache.org
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message