Giter Club home page Giter Club logo

Comments (5)

tjeb avatar tjeb commented on September 2, 2024 2

and suddenly the next release is not far away at all anymore.

I think I have a solution for this (and the related issue that the currency check was too wide-sweeping anyway), pushed in the branch above.

One note though; there are other places where an attribute is used in the context selector (some of them in code we originally got from the peppol bis v2 group), going over all of them and finding potential overlapping context matches may be too much work for 1.2.

It's not phased out yet, but it will be made optional for receivers soon, so it should then only be in use by parties that were already (successfully) using it and have not been able to move to 2.0 or PB3 yet.

from validation.

tjeb avatar tjeb commented on September 2, 2024

The suggested fix in and of itself isn't good, as the rules would then match any element that has a currencyID, and not the currencyID attribute node itself (thereby potentially exluding those nodes from later checks).

And I may be wrong of course, but isn't this really a bug in the validation engine? An attribute is a node, and is selectable by an xpath expression such as those in context attributes. I don't have the latest version of the schematron specification readily available now that it got ISO-paywalled, but AFAIK it did not put any limitations on the types of selectable nodes in the context expression.

from validation.

phax avatar phax commented on September 2, 2024

@tjeb thanks for the swift response.

I had created copies of the previous spec versions - you can find them at https://github.com/phax/ph-schematron/tree/master/docs

The interesting link in the source issue points to Stack Overflow:
Source: https://stackoverflow.com/a/28305335/15254

The problem with your current approach is that the template matching the attribute/s is never applied. It isn't applied, because the built-in template rule matches only the root node and element nodes, and it applies templates only to children nodes. To apply a template to attributes, you must apply it explicitly yourself.

This points to the XSLT 2.0 spec: https://www.w3.org/TR/xslt20/#built-in-rule

When a node is selected by xsl:apply-templates and there is no template rule in the stylesheet that can be used to process that node, a built-in template rule is evaluated instead.

The built-in template rules apply to all modes.

The built-in rule for document nodes and element nodes is equivalent to calling xsl:apply-templates with no select attribute, and with the mode attribute set to #current. If the built-in rule was invoked with parameters, those parameters are passed on in the implicit xsl:apply-templates instruction.

Reading on, what "xsl:apply-templates with no select attribute" means: https://www.w3.org/TR/xslt20/#element-apply-templates

The default value of the select attribute is child::node(), which causes all the children of context node to be processed.

And finally the "node()" function is described at https://www.w3.org/TR/xslt20/#pattern-examples

node() matches any node other than an attribute node, namespace node, or document node.

Hence, the default XSLT template processing does not include attribute nodes.

I agree, that my proposed resolution is eventually not ideal - but the general problem remains the same. Maybe you can place the assertion in an all the places where you need them, but using an attribute as a selector is not a general purpose solution imho.

from validation.

tjeb avatar tjeb commented on September 2, 2024

Luckily we have a few months until the next release cycle... there's other attributes that are used as selectors as well

But does this mean the Schematron (2016) specification is unimplementable, or is this only a limitation of some implementation choices? Annex H point 2 clearly states a rule context rules may be attributes.

from validation.

phax avatar phax commented on September 2, 2024

Sorry I found no time yet, to properly respond to this, but I want to. My assumption is, that this is exactly the "magic" in the boilerplate code, the XSLT implementations create....

from validation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.