xsl-list
[Top] [All Lists]

[xsl] sort problem

2011-01-05 10:38:24
I am aggregating and sorting long lists of codes in this format:

<list>
      <cc area="W" main="7">W.7</cc>
      <cc area="W" main="8">W.8</cc>
      <cc area="W" main="4">W.4</cc>
      <cc area="W" main="1">W.1</cc>
      <cc area="W" main="1" exp="a">W.1.a</cc>
      <cc area="W" main="1" exp="b">W.1.b</cc>
      <cc area="W" main="1" exp="c">W.1.c</cc>
      <cc area="W" main="7">W.7</cc>
      <cc area="W" main="8">W.8</cc>
      <cc area="W" main="9">W.9</cc>
</list>

Here is my 2.0  template:

<xsl:template match="list">
        <list>
       
        <xsl:for-each-group select="." group-by="cc">
        <xsl:sort select="@area" order="descending"/>
        <xsl:sort select="@main" data-type="number"/>

               
              
                <xsl:if test="position()>1"><xsl:text>, </xsl:text>
                    <xsl:value-of select="current-grouping-key()"/>
                </xsl:if>
                <xsl:if test="position()=1">
                    <xsl:value-of select="current-grouping-key()"/>
                </xsl:if>
                
                
              
            </xsl:for-each-group>
        
</list>
    </xsl:template>


As you can see from the output below, the grouping works: the two W.7 were 
successfully reduced to 1. However, the sorts are not working. I have the 
feeling that I am missing something simple. 


<list>W.7, W.8, W.4, W.1, W.1.a, W.1.b, W.1.c, W.9</list>

I am using Oxygen, Saxon-B 9.0.0.6

Terry




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>