xsl-list
[Top] [All Lists]

RE: [xsl] Sorting chemical formulae in XSLT 2.0

2010-11-25 04:16:31
From: emmanuel(_dot_)begue(_at_)gmail(_dot_)com 
[mailto:emmanuel(_dot_)begue(_at_)gmail(_dot_)com] On Behalf Of Emmanuel Bégué
I think regexp would help. While it's been a while since I have had to
deal with chemical elements, and am therefore not sure I completely
understand your requirements, the following stylesheet gives the
expected result:

Thanks, that's exactly the kind of solution I was after, and it sorts the 
elements in the full list correctly (at least based on the sample list I've 
been given).

The Saxon collation David suggested looks like a very useful tip, but in this 
case, it sorted the numbers before the letters, so CH2O appeared after C2Cl4 
which wasn't the desired outcome. I dare say it would have worked with some 
tweaking, but the regex solution is perfect.

Cheers,
Emma

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>