Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a general dynamic error for "problem with XPath expression" #1117

Open
ndw opened this issue Dec 4, 2024 · 2 comments · May be fixed by #1122
Open

Add a general dynamic error for "problem with XPath expression" #1117

ndw opened this issue Dec 4, 2024 · 2 comments · May be fixed by #1122

Comments

@ndw
Copy link
Contributor

ndw commented Dec 4, 2024

We have err:XS0107 for static errors in XPath expressions, but nothing equivalent for dynamic errors. We often have specific errors for specific problems, but we need a catch-all. (Reporting err:XS0107 is just...wrong)

@xml-project
Copy link
Member

One use case would be (variants) of:

 <p:add-attribute attribute-name="att">
        <p:with-input><doc /></p:with-input>
        <p:with-option name="attribute-value" select="fn:upper-case(2)"></p:with-option>
</p:add-attribute>

This has to raise an error because the XPath expression in select has an error for the integer parameter.
But currently there is no error code for this. So my implementation has to use the generic XD0030. I would prefer an other error code being directly related to the XPath expression.

@ndw
Copy link
Contributor Author

ndw commented Dec 6, 2024

In the past few days, Achim and I have both stumbled over how to report errors in XPath expressions that aren't detected until runtime. For some errors of this form, we have specific error codes, but there's no general catch-all for "it didn't work." My implementation has been using err:XS0107, the static version of "invalid expression", but that's really inappropriate for a dynamic error.

I'm not sure where to add this to the specification, but I don't expect any pushback on the requirement, so I've proactively created a dynamic error for it:

err:XD0083: It is a dynamic error if an XPath expression cannot be evaluated, e.g. because the expression is not syntactically valid, contains reference to unknown variables, or makes use of undeclared functions.

@ndw ndw linked a pull request Dec 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants