On 2/6/06, cknell(_at_)onebox(_dot_)com <cknell(_at_)onebox(_dot_)com> wrote:
Given a set of numbers such as the list below, is there a collation for
sorting these in such a way that, for example, 3.3.1.1.11 comes after
3.3.1.1.2?
The numbers are the text nodes of a set of elements produced with an
<xsl:for-each-group>.
3.1.1.3.1
3.1.1.3.2.4.2
3.1.1.3.4
3.2.1.1.7.3.8
3.4.4.1.10
3.4.4.1.11
3.1.1.3.7
3.1.1.3.8
3.1.1.3.9
3.1.1.3.10
3.1.1.3.11
3.1.1.4.1.1
3.1.1.4.1.2
3.1.1.4.1.3
3.1.1.4.1.4
3.1.1.4.1.5
3.1.1.4.1.6
3.1.1.4.1.7
3.1.1.4.1.8
3.1.1.3.2.2
3.1.1.1.1.1.17
How about the brute force technique:
<xsl:for-each-group ...>
<xsl:sort select="tokenize(.,'\.')[1]" data-type="number"/>
<xsl:sort select="tokenize(.,'\.')[2]" data-type="number"/>
<xsl:sort select="tokenize(.,'\.')[3]" data-type="number"/>
<xsl:sort select="tokenize(.,'\.')[4]" data-type="number"/>
<xsl:sort select="tokenize(.,'\.')[5]" data-type="number"/>
<xsl:sort select="tokenize(.,'\.')[6]" data-type="number"/>
</xsl:for-each>
Obviously this doesn't scale well :)
--~------------------------------------------------------------------
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>
--~--