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

RE: Strings Comparison Question.

Subject: RE: Strings Comparison Question.
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 16 Jan 2003 19:22:10 -0000
muenchian grouping alphabetizing names
> 
> 1. Is it possible to compare two strings lexicographically in 
> XSL/XPATH? I believe the answer is no. Is there a way I can 
> achieve this?

Not directly (in XSLT 1.0), but you can do it with the node-set
extension. Write the two strings as nodes in a tree, sort the nodes, and
see which one comes first in the result.
> 
> 
> 2. I have listed the XML & XSL below.   In that the community 
> name attribute
> could start with a alphabet, a number or any other character. 
>   Most of the
> community names are expected to start with alphabets.  In my 
> output, if I have one or more community name starting with a 
> certain alphabet (i.e. 'A') then I want to put a link (aka 
> advance orgranizer) at the top of the page that would say 'A' 
> and likewise for all the alphabets.  Also since I have few 
> communities starting with non-alphabets, I would want to put 
> a link called Miscellaneous that would link to a page which 
> would display all non-alphabetic characters.

This is a kind of grouping problem: you want to form groups of items
that start with the same letter. Use Muenchian grouping, with a key
defined as

<xsl:key name="g" match="name" use="substring(.,1,1)"/>

Read about Muenchian grouping at
http://www.jenitennison.com/xslt/grouping

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 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.