Skip to content

Error in use of fold-left() #2

@joewiz

Description

@joewiz

In https://github.com/jpcs/transform.xq/blob/master/lib/compile_pattern.xq#L66-L86, the 3rd parameter of fold-left() is provided as a node, but the 3.0 F&O spec for fold-left() states that the 3rd parameter should be of type function: https://www.w3.org/TR/xpath-functions-30/#func-fold-left.

I came across this when trying to run the sample scripts in eXist (current develop branch). The exact error:

Cannot compile xquery: exerr:ERROR XPTY0004/FOCH0002: Supplied argument 3 of function: fold-left($sequence as item()*, $zero as item()*, $function as function) item()* does not match required type. Required type function, got node(). [at line 70, column 7, source: /db/transform.xq-master/lib/compile_pattern.xq]

My guess is that your use of fold-left() was based on an earlier draft of the 3.0 F&O spec.

(The other issue I had to work around was renaming your map module's namespace prefix, as map is now reserved for http://www.w3.org/2005/xpath-functions/map. A quick rename to snelson-map worked though.)

Do you have any pointers for how to approach fixing the fold-left() issue? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions