xsl-list
[Top] [All Lists]

Re: [xsl] Sort List of Maps By Key Value

2018-10-01 10:30:31
Thanks--that's very helpful. I will cogitate on this more.

Cheers,

E.

--
Eliot Kimber
http://contrext.com
 

On 9/29/18, 4:51 PM, "Michael Kay mike(_at_)saxonica(_dot_)com" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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
    
    
    
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] Sort List of Maps By Key Value, Eliot Kimber ekimber(_at_)contrext(_dot_)com <=