sissaschool/elementpath

Trouble using extended operators

RaphaelHerd opened this issue · 1 comments

Hello together,

I have a problem understanding how to use extended functions of Xpath 3.1. Following to https://www.w3.org/TR/xpath-functions-31/ you can use functions which are in the namespace "op" (e.g. https://www.w3.org/TR/xpath-functions-31/#func-dateTime-less-than). When I'm trying using that functions, I receive an error that "prefix 'op' is not declared". I guess I'm doing something wrong.

Here is my sample and it would be nice if someone could help me with this. I guess its just a problem from my side using the lib.

`
xPathQuery="for $wo in .//WorkOrder return op:dateTime-less-than(xs:dateTime($wo/@DueDate), max(for $sc in $wo/.//Phases/.//Schedule return xs:dateTime($sc/@EnD)))"

queryResult = elementpath.select(root, xPathQuery, parser=XPath30Parser)
print("Total tardiness : ", queryResult)
`

Hi,

from https://www.w3.org/TR/xpath-functions-31/#intro:

Functions defined with the op prefix are described here to underpin the definitions of the operators in [[XML Path Language (XPath) 3.1]](https://www.w3.org/TR/xpath-functions-31/#xpath-31), [[XQuery 3.1: An XML Query Language]](https://www.w3.org/TR/xpath-functions-31/#xquery-31) and [[XSL Transformations (XSLT) Version 3.0]](https://www.w3.org/TR/xpath-functions-31/#xslt-30). These functions are not available directly to users, and there is no requirement that implementations should actually provide these functions. For this reason, no namespace is associated with the op prefix.

so operators are not available as functions, use the equivalent operator (it should be lt).