Subject: Re: [xsl] How to QuickSort a map? From: "Sean B. Durkin" <sean@xxxxxxxxxxxxxxxxx> Date: Fri, 30 Aug 2013 01:53:55 +1000 |
<xsl:function name="f:print-map" as="xs:string*"> <xsl:param name="m" as="map(xs:anyAtomicType, item()*)" />
<xsl:value-of select=" let $quick-sort := function( $s as xs:string, $sort-2 as function(xs:string, function()) as xs:string* { if (count($s) lt 2 then $s else $sort-2( $s[. lt $s[1]]) , $s[1] , $sort-2( $s[( . ge $s[1]) and (position() ne 1))} return $quick-sort( map:keys($m), $quick=sort()) ! (., '-', map:get($m, .))"/> </xsl:function>
Faithfully, Sean B. Durkin
For example to sort On 29/08/2013 7:51 PM, Costello, Roger L. wrote:
Sean Durkin wrote:
XPath 3 can now implement QuickSort in 3 lines of code.Sean (or anyone) would you show how to implement the QuickSort please?
That is, would you replace the ??? in the below function with the code please?
---------------------------------------------------------------------
<xsl:function name="f:sort-map" as="map(xs:anyAtomicType, item()*)">
<xsl:param name="m" as="map(xs:anyAtomicType, item()*)" />
???
</xsl:function>
---------------------------------------------------------------------
/Roger
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How to QuickSort a map?, Costello, Roger L. | Thread | Re: [xsl] How to QuickSort a map?, Wolfgang Laun |
Re: [xsl] [XSLT Streaming] Are xsl:, David Carlisle | Date | Re: [xsl] [XSLT Streaming] Are xsl:, Michael Kay |
Month |