Ben

Have a look at the recent xsl mailing list archives... I have 
been having *exactly* the same problems (choosing a 
sort selection dynamically) and there were a number of 
very helpful answers from the folks there!

http://www.mulberrytech.com/xsl/xsl-list

Derek

PS and yes, <xsl:param> must *always* come before
your template matches - suggest you find some some
good reading material on XSL and get to grips with the
basics... I reccommend Michael Kay's XSLT Programmer's
Reference.

>>> [EMAIL PROTECTED] 2004/07/19 02:43:53 AM >>>
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] 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to