xsl-list
[Top] [All Lists]

Re: Re: Collation for dotted decimal?

2006-02-07 12:14:48
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.

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