RE: [xsl] alphabetical listing

Subject: RE: [xsl] alphabetical listing
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 9 Jun 2004 10:30:30 +0100
> I am looking for a way to list all occurences of a given 
> element in a separate
> file given the first or first two letters. I want that 
> because i need a listing,
> and have a lot of items.

Do you want an entry for "Q" if you have no element starting with "Q"? This
affects the strategy. If you don't, then you have a classic grouping
problem, (see with a grouping key
of substring(.,1,1) for the first letter, or substring(.,1,2) for the first

If you do want an entry for absent letters, then you are essentially doing
an outer join of your data with the alphabet, so you need a table somewhere
that defines the alphabet: an alternative to your explicit iteration through
the alphabet is to put the letters of the alphabet as elements in a separate
tree and iterate over that.

Michael Kay

> What i do for now is doing a for-each 
> select="item[starts-with(name,'a')]" ...
> with a through z, A through Z and a cumbersome last for-each 
> with many 'and not
> starts-with' which is ugly. And slow.
> There MUST be another, more efficient, more elegant, cleaner 
> way of doing that !
> But sadly i can't seem to find the idea how... If you have 
> any idea, feel free
> to help !
> Nicolas
> --+------------------------------------------------------------------
> XSL-List info and archive:
> To unsubscribe, go to:
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--

Current Thread