xsl-list
[Top] [All Lists]

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

2022-01-07 12:11:23

In my XQuery script I’m building a map from all the image files in a 
directory tree (using BaseX’s file extensions):
 
let $files := file:list($rootDir, true(), ‘*.png’)
let $imageMap := map:merge(
for $file in $files
map:entry(local:getFilename($file), map{‘path’ : $file, ‘keyname’, 
local:getKeyName($file))
)
 
At this point $imageMap is a map where each entry’s value is also a map.

Then declare it as such: don't forget the "as" clause. Declaring the types of 
your variables would have caught the bug for you. It would also have made the 
code more readable.

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>