[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Collation for dotted decimal?
On 2/6/06, cknell@xxxxxxxxxx <cknell@xxxxxxxxxx> 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 :)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|