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

p:assert #44

Open
JDziurlaj opened this issue Feb 24, 2023 · 2 comments
Open

p:assert #44

JDziurlaj opened this issue Feb 24, 2023 · 2 comments

Comments

@JDziurlaj
Copy link

p:assert functions as an assert in other languages, such as xsl. It takes in a XPathExpression coerced to a boolean if required, and throws a dynamic error if the assertion fails.

<p:assert
  name? = NCName
  test = XPathExpression
  code = QName
</p:assert>

I am not sure if collection? is required here, I don't use it. It may be useful for this step to have a port that can be used to construct the error, akin to p:error.

@xatapult
Copy link
Contributor

xatapult commented Mar 2, 2023

I suppose you are suggesting adding a p:assert to the step library? That sounds like something for the https://github.com/xproc/Vnext repository... Shall I transfer it to there?

@ndw
Copy link

ndw commented May 31, 2024

I happened to want exactly this step just the other day. You can do approximately the same thing with:

<p:if test="..."><p:error code="..."/></p:if>

but that's not as neat.

@ndw ndw transferred this issue from xproc/3.0-steps Jun 6, 2024
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

No branches or pull requests

3 participants