cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: xsl:sort in 2.1.4 not working
Date Sun, 11 Apr 2004 20:04:57 GMT
On 11.04.2004 21:01, Rick Tyler wrote:

> I just installed Cocoon 2.1.4 under Windows 2000 and am trying to do a trivial sort,
but regardless of what I do, the output appears in the same (apparently random) order.  Why?!


> XSL:
> <xsl:template match="items">
>  <xsl:apply-templates>
>   <xsl:sort select="item/color">
>  </xsl:apply-templates>
> </xsl:template>
> <xsl:template match="item">
>  <xsl:value-of select="name"/>
> </xsl:template>
> The problem is: it doesn't matter what expression I use in the xsl:sort statement ("item/color"
or "item/name" or "item/shape") because the output never changes.  This implies to me that
the xsl:sort statement is being ignored for some reason.  Is it possibility that I messed
up the configuration of Cocoon such that some features of XSL work and other don't?  I am
baffled because this seems like such basic functionality.
> What am I doing wrong?!

With apply-templates you already change the context of the sort 
expression to the child nodes. From the child nodes (including 
whitespace-only text nodes and item elements) the sort expression 
item/color is evaluated, but obviously not found. Nothing can be sorted.

Try <xsl:sort select="color"/>. Or to make it more obvious:

<xsl:apply-templates select="item">
   <xsl:sort select="color"/>


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message