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

Subject: Re: [xsl] Subtle (or not?) Map Processing Bug in XQuery
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Jan 2022 18:11:18 -0000
> In my XQuery script Ibm building a map from all the image files in a
directory tree (using BaseXbs file extensions):
>
> let $files := file:list($rootDir, true(), b*.pngb)
> let $imageMap := map:merge(
> for $file in $files
> map:entry(local:getFilename($file), map{bpathb : $file, bkeynameb,
local:getKeyName($file))
> )
>
> At this point $imageMap is a map where each entrybs 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

Current Thread