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

Re: Subtle (or not?) Map Processing Bug in XQuery

Subject: Re: Subtle (or not?) Map Processing Bug in XQuery
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Jan 2022 17:45:43 -0000
Re:  Subtle (or not?) Map Processing Bug in XQuery
Christian and Jean-Paul,



I hadnbt thought about map:for-each() (not sure I even realized it was an
option).



Ibll have to think about that more.



Map:for-each() B feels very familiar to my JavaScript brain (which it pains me
to admit I even have but there it is).



Ibll check out Joebs book...



Cheers,



E.



--

Eliot Kimber

http://contrext.com







From: "Christian GrC<n christian.gruen@xxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Reply-To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Date: Friday, January 7, 2022 at 11:21 AM
To: xsl-list <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Subtle (or not?) Map Processing Bug in XQuery



Hi Eliot,



Ibm also wondering if therebs any general source of XQuery coding patterns
for working with maps in non-trivial ways? I havenbt run across one but I
havenbt looked too hard yet.



You could use map:remove, either with map:keysb&



let $orphanMap := map:remove($imageMap,

  map:keys($imageMap)[not(local:notReferenced($imageMap(.)('keyname')))]

)



b&or in combination with map:for-each:



let $orphanMap := map:remove($imageMap,

  map:for-each($imageMap, function($k, $v) {

    if(local:notReferenced($v('keyname'))) then () else $k

  })

)



XQuery 4.0 will probably include a map:filter function [1] and,

possibly, additional functions for iterating over the entries of a map

[2].



Hope this helps,

Christian



[1]
https://qt4cg.org/branch/master/xpath-functions-40/Overview.html#func-map-fil
ter

[2] https://github.com/qt4cg/qtspecs/issues/29

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.