[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Collation for dotted decimal?

Subject: Re: Re: Collation for dotted decimal?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 8 Feb 2006 06:14:48 +1100
collation name decimal
> > What I understand this to do is to select the shortest dotted-decimal in
the document,
> er, I think that's a bug, should be longest (change 1 to last())


yes, and I missed
   order="descending".

So, once again the code (corrected):

<xsl:stylesheet version="2.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output indent="yes"/>

   <xsl:template match="x">
     <xsl:variable name="vPattern">
       <xsl:for-each select="*">
         <xsl:sort select="string-length(.) order="descending""/>
           <xsl:if test="position() = 1">
             <xsl:sequence select="translate(.,'123456789.', '000000000')"/>
           </xsl:if>
       </xsl:for-each>
     </xsl:variable>
 <x>
   <xsl:perform-sort select="*">
     <xsl:sort select="string-join(for $i in tokenize(.,'\.') return
                               format-number(number($i),$vPattern),'.')"/>
     </xsl:perform-sort>
 </x>
 </xsl:template>
</xsl:stylesheet>



--
Cheers,
Dimitre Novatchev
---------------------------------------
The significant problems we have cannot be solved at the same level of
thinking with which we created them.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.