Project

Profile

Help

arch:extract-map multiple method matches

Added by Joel Kalvesmaki over 4 years ago

I am experimenting with the expath-archive function library. So far, arch:*-map() functions in general seem to work fine, but whenever I invoke arch:extract-map($i, $j), I get this validation error:

[Saxon-EE 9.8.0.12] There is more than one method matching the function call arch:extract-map, and there is insufficient type information to determine which one should be used

This happens even when explicitly assigning types to input $i and $j. oXygen doesn't give function prompts for the expath-archive function library, so I can't tell what's expected of me. Does Saxon EE have multiple 2-arity forms of arch:extract-map()? Any suggestions?


Replies (2)

RE: arch:extract-map multiple method matches - Added by John Lumley over 4 years ago

Yes - it certainly looks as if this has uncovered an (untested) error that has been there for at least 5 years! It appears as if an internal method was declared public when it needn't have been, as is discovered by reflexive extension function search.

However it is a little more complicated as the status of EXPath Archive is complex. For more details and our response, please see https://saxonica.plan.io/issues/4361

As a workaround of course you could use the XPath equivalent code described at http://expath.org/spec/archive/editor#fn.extractmap, which only uses arch:extract-binary(), which is supported

RE: arch:extract-map multiple method matches - Added by Joel Kalvesmaki over 4 years ago

Thank you, John -- how interesting that it's lain dormant so long. I don't know whether to feel good or awful.

I found the XPath equivalent code very helpful to follow, and I replicated it with XSLT. If and when this expath module moves along, I'll remark here that the sole condition $text := map:contains($a,'encoding'), might need some thought. In many (most?) the key 'encoding' will not be present because content is marked as being compressed, and needs to be decoded. In other cases the content will itself be an archive.

I have written in XSLT a version of arch:extract-map() that decodes strings and recursively unpacks archives, using arch:entries-map(). I hope to make this code available in a revision I'm making to my xslt-for-docx. No doubt my code will have rough edges, but I hope it at least catalyzes some better ideas.

    (1-2/2)

    Please register to reply