I think this should work in XSLT 1.0:
<xsl:sort select="concat(substring-after(concat(normalize-space(.),' '),'
'),normalize-space(.))" />
David.
--
David McNally Moody's Investors Service
Senior Software Engineer 99 Church St, NY NY 10007
David(_dot_)McNally(_at_)Moodys(_dot_)com 212-553-7475
-----Original Message-----
From: John Fitzgibbon [mailto:jfitzgibbon(_at_)Galwaylibrary(_dot_)ie]
Sent: Thursday, March 03, 2005 10:32 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] a sorting conundrum
Hi,
I am attempting to sort an a list of personal names. All of
the names consist of either a first name followed by a last
name or of a last name only (there are no middle names). Both
parts of the name, when present, are enclosed within the one
tag (span) which has a class='person' attribute, the same tag
is used to enclose a last name only. I am attempting to sort
by last name like so
<xsl:for-each select="html/body//span[(_at_)class='person']">
<xsl:sort select="substring-after(., ' ')"/>
<xsl:sort select="."/>
<xsl:sort select="substring-before(., ' ')"/>
The problem is that names consisting of a last name only
appear first in my alphabetical sequence and are sorted;
these are followed by names with a first name and a last name
and these are also sorted. I require one alphabetical list
rather than two.
Can this be done in one fell swoop, without having to write
an XSL style sheet for the file consisting of two
alphabetical sequences?
Any suggestions would be most welcome.
Regards
John
John Fitzgibbon
Galway Public Library
Island House
Cathedral Square
Galway
Ireland
p: 00 353 91 562471
f: 00 353 91 565039
w: http://www.galwaylibrary.ie
*******************************************************************
Tá eolas atá príobháideach agus rúnda sa ríomhphost seo
agus aon iatán a ghabhann leis agus is leis an duine/na
daoine sin amháin a bhfuil siad seolta chucu a bhaineann siad.
Mura seolaí thú, níl tú údaraithe an ríomhphost nó aon iatán
a ghabhann leis a léamh, a chóipáil ná a úsáid.
Má tá an ríomhphost seo faighte agat trí dhearmad,
cuir an seoltóir ar an eolas thrí aischur ríomhphoist
agus scrios ansin é le do thoil.
This e-mail and any attachment contains information which is
private and confidential and is intended for the addressee
only. If you are not an addressee, you are not authorised
to read, copy or use the e-mail or any attachment.
If you have received this e-mail in error, please notify
the sender by return e-mail and then destroy it.
*********************************************************************
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
---------------------------------------
The information contained in this e-mail message, and any attachment thereto,
is confidential and may not be disclosed without our express permission. If
you are not the intended recipient or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified that
you have received this message in error and that any review, dissemination,
distribution or copying of this message, or any attachment thereto, in whole or
in part, is strictly prohibited. If you have received this message in error,
please immediately notify us by telephone, fax or e-mail and delete the message
and all of its attachments. Thank you.
Every effort is made to keep our network free from viruses. You should,
however, review this e-mail message, as well as any attachment thereto, for
viruses. We take no responsibility and have no liability for any computer
virus which may be transferred via this e-mail message.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--