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

Re: Sort By Multiple Values?

Subject: Re: Sort By Multiple Values?
From: Alice Wei <ajwei@xxxxxxxxxxx>
Date: Thu, 27 Dec 2007 13:59:53 -0500
Re:  Sort By Multiple Values?
Hi, Abel:

Thanks for trying, the result did not come out as expected. After implementing the code, I even tried to reverse the order of it, but both of the "result" came out interestingly.

Here is the result:
  HTML 4.01 / XHTML 1.0, CSS, XML 1.0, XSLT 1.0 and XSLT 2.0

It appears that it is following some order, but it does not appear to follow the order according to to "type."

Do I have to use a <xsl:when> statement to enforce its sequence?

Thanks for your help.

Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei@xxxxxxxxxxx
812-856-2659

Quoting Abel Braaksma <abel.online@xxxxxxxxx>:

Alice Wei wrote:


The XSL:

  <xsl:template match="computer">
  [<span class="skills">
                       <xsl:apply-templates select="language">
                           <xsl:sort select="@rank" order="ascending"/>
                       </xsl:apply-templates>
                   </span>]
</xsl:template>

The output now is in the same order as it is in the order of the
document w= hen the @rank value is 1, and followed by the one where
@rank=2.

[XML 1.0] [XSLT 1.0] [HTML 4.01/XHTML 1.0] [CSS] [XSLT 2.0].

Is it possible that I can get it to display as

[CSS] [HTML 4.01/XHTML 1.0] [XML 1.0] [XSLT 1.0] [XSLT 2.0]

One way to achieve that is to change your sort to select="type" (since the requested order is strictly alphabetical by type), but from your postings subjectline, I think you mean how to sort on several values, which is done by adding more xsl:sort values under each other:

<xsl:sort select="@rank" />
<xsl:sort select="type" />

HTH,
Cheers,
-- Abel Braaksma

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.