xsl-list
[Top] [All Lists]

Re: Collation for dotted decimal?

2006-02-06 17:53:12
Couldn't resist to make David's solution general (not dependent on a
maximum digits in a number estimate) :o)    :


<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(.)"/>
            <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.



On 2/7/06, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:


http://www.biglist.com/lists/xsl-list/archives/200601/msg00638.html

or a different variation at

http://lists.xml.org/archives/xml-dev/200602/msg00006.html

or wait for a later version of saxon (see Michael's comment in one of
those threads:-)

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

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



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