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

Re: Sort List of Maps By Key Value

Subject: Re: Sort List of Maps By Key Value
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Oct 2018 15:30:25 -0000
Re:  Sort List of Maps By Key Value
Thanks--that's very helpful. I will cogitate on this more.

Cheers,

E.

--
Eliot Kimber
http://contrext.com


o;?On 9/29/18, 4:51 PM, "Michael Kay mike@xxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

    >
    > I'm still trying to get my head around how to use the "?" operator

    If you think of a map as being like an element with attributes but no name
and no children, then unary "?" behaves like unary "@", while binary "?"
behaves like "/@"

    Compare

    let $e := (<e x="1" y="2" z="3"/>, <e x="10" y="20" z="30"/>

    let $m := (map{"x":1, "y":2, "z":3}, map{"x":10, "y":20, "z":30})

    then $m?x corresponds to $s/@x (returning (1, 10))

    and $m[?x = 1]?y corresponds to $e[@x = 1]/@y (returning 2)

    The analogy starts to break down for dynamic references:

    $m?($key) corresponds to $e/@*[name()=$key] (But you can also write it as
$m($key) to save one keystroke)

    Michael Kay
    Saxonica

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.