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

RE: Sorting issue, sorting by description given code

Subject: RE: Sorting issue, sorting by description given code
From: Jarno.Elovirta@xxxxxxxxx
Date: Wed, 29 Oct 2003 08:51:18 +0200
code for sort search names
Hi,

> Aim: To output a list of those Group names for which a Point 
> belongs to,
> sorted alphabetically.
> 
> From above we have three points, so the desired result would be thus
> 
> Group List...
> 
> DEFAULT
> LOTS
> TREES 

You're almost there, see the inline comments.

  <xsl:key name="groups" match="Point" use="@group" />
  <!-- Add new key for sorting -->
  <xsl:key name="x" match="Group" use="@num" />
  <xsl:template match="SEEDB">
    <table class = "style1" border="1" cellspacing="0" cellpadding="2" width="650">
      <tr >
        <th align="center">Point Groups</th>
      </tr>
      <xsl:for-each select="Points/Point[generate-id(.) = generate-id(key('groups',@group)[1])]">
        <!-- Sort according to the name -->
        <xsl:sort select="key('x', @group)/@name" data-type="text"/>
        <xsl:apply-templates select="."/>
      </xsl:for-each>
    </table>
  </xsl:template>
  <xsl:template match="Point">
    <tr>
      <td align="center">
        <!-- You had a variable $group here, you want to use current() function -->
        <xsl:value-of select="/SEEDB/Groups/Group[@num = current()/@group]/@name"/>
      </td>
    </tr>
  </xsl:template>

> sort the nodeset, and then output, but I wanted to avoid this if
> possible, since I am led to believe that some parsers don't have an
> equivalent "msxsl:node-set" function.

Well, almost, if not all XSLT processors have some sort of e:node-set extension. See <http://exslt.org/> for the common extension for RTF -> node-set conversion.

Cheers,

Jarno - Assemblage 23: Pages

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.