[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

sort problem

Subject: sort problem
From: Terry Ofner <tdofner@xxxxxxxxx>
Date: Wed, 5 Jan 2011 11:38:08 -0500
 sort problem
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.