Re: [xsl] Natural Sort

Subject: Re: [xsl] Natural Sort
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 25 Jan 2006 14:40:27 GMT
I keep forgetting that the sort expression needn't be a single xpath in
xslt2, so in that case you don't need to use the tricky replace regexp
to add the zero, you can do what I had in mind really and use
format-number to express all numbers with teh same number of digits.

This version works up to 6 digits (and without the
restrictions on digit runs being close)

  <xsl:for-each select="server">
      <xsl:analyze-string select="@dn" regex="[0-9]+">
          <xsl:value-of select="format-number(number(.),'000000')"/>
	 <xsl:value-of select="."/>
      <xsl:copy-of select="."/>

This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread