-
Notifications
You must be signed in to change notification settings - Fork 88
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
xsl:* (or other non-sch:*) not allowed within constraintSpec #1607
Comments
Can you not use https://www.xml.com/pub/a/2003/11/12/schematron.html#Variables_using_let |
@martindholmes Alas, not that I can see. The Schematron |
@martindholmes OK--for dates, there is a handy XPath function for conversions that would work in sch:let: http://www.sixtree.com.au/articles/2013/formatting-dates-and-times-using-xslt-2.0-and-xpath/ I see we also have a format-integer() function in XPath 3.0, which works similarly on picture strings and patterns. But the xsl:variable solution is a simpler (less verbose) implementation on reading numbers to Roman numerals. And it's tidy--a convenient functionality that works in standalone Schematron. So that's really my question here--why can't we use xsl: variable functionality in the ODD environment just as we can in native Schematron? Just because we could write a more verbose XPath function in a Schematron let statement doesn't make that solution more desirable. We ought to have the benefit of the full range of things we can write in a Schematron file within the constraintSpec elements of an ODD. |
I don't see any objection to allowing elements in the XSLT namespace into constraintSpec, and your use-case seems compelling. |
By coincidence, last Friday I had started drafting an issue on exactly this same problem (tei_odds being too strict about xsl descendants of I was holding back to post the issue here, since it involves multiple TEI repos (TEI and Stylesheets, to tackle some XSLT elements that are not being copied properly, while they seem perfectly valid in the generated schema). While experimenting a bit in order to get a good test case, I had noticed how all XSLT elements I drop in Schematron tend to be accepted and executed by the validation engine in Oxygen. Yet, I'm not sure at all which XSLT elements are really allowed, and if the (validation framework in) Oxygen might be too permissive, so I'm trying to clarify this first. I've posted this on the Oxygen forum (https://www.oxygenxml.com/forum/topic14236.html), hoping to get feedback there, so I know what XSLT content is actually allowed before making any suggestions for ODD processing. |
Ok, it seems that a) while XSLT support inside Schematron is implementation-dependent, b) the Schematron “Skeleton” Implementation that is used by Oxygen allows for XSLT inside Schematron. In his answer to my question Octavian mentions this implementation as the reference implementation, which seems to me a further argument for allowing xsl:* elements inside |
Annex H of the Schematron 2016 standard: http://standards.iso.org/ittf/PubliclyAvailableStandards/c055982_ISO_IEC_19757-3_2016.zip should tell us what aspects of XPath and XSLT2 are formally supported by Schematron. It says:
I'm not sure whether this means that anything and everything from XSLT2 is allowed in a Schematron rule if the xslt2 query language binding is invoked. It also says:
It doesn't look very thoroughly proofed, but this suggests that sch:let and xsl:variable are equivalent, and therefore that you should be able to use xsl:variable. If the standard permits it, and the most common implementations support it, then TEI should support it too. |
Indeed, the implementation seems to allow far more XSLT constructs than are specified by the standard, and Octavian's answer on the Oxygen support forum seems to confirm this. I've created a gist with some XSLT elements that are not mentioned in the standard, and this just seems to work. So, the situation is indeed a bit hazy: the standard only lists a couple of XSLT elements (while not prohibiting others, though), while the implementation is much more permissive. UPDATE: In his answer to my question on the Skeleton implementation tracker, Rick Jelliffe has confirmed the fact that the implementation allows more XSLT elements than defined by the Schematron standard, and ensured that this can be considered a stable feature. |
Also, I think it would make sense to allow nodes from the Schematron Quick Fix namespace (http://www.schematron-quickfix.com/validator/process) inside |
I have not read most of this ticket, but rather came across it while trying to do due diligence before creating a new one for a bug that Martin & I just discovered. In constraint.xml, the content model for <alternate minOccurs="0" maxOccurs="unbounded">
<textNode/>
<anyElement require="http://purl.oclc.org/dsdl/schematron"/>
</alternate> which is, frankly, wrong. The content of P.S. My finding this bug springs from the need to have elements in the Schematron Quick Fix namespace in a |
This is probably related, though I don't know if it deserves its own issue (and what to report, then): during the TEIP5-dev build process on the TEI Jenkins server, an error was thrown during the When building a RelaxNG schema locally, everything works without problems, and -besides the tons of "constraint descendants must be in the namespaces 'http://purl.oclc.org/dsdl/schematron', http://www.tei-c.org/ns/1.0'" warnings reported in this issue-, no errors are flagged for the occurrence of Yet, during the build process, some validation process is choking on this, and causing the build to fail, with following message:
According to the SQF documentation at http://schematron-quickfix.github.io/sqf/publishing-snapshots/April2015Draft/spec/SQFSpec.html#d0e227, |
…he TEI build seems to choke on this (see TEIC#1607 (comment)) -changed @scheme to "schematron" ("isoschematron" seems to have been deprecated)
I claim that if we add this line:
at line 133 of p5odds.odd, we should fix the problem. Any reason not to do this? |
Yes, I think that would solve this problem, and might be the appropriate thing to do for p5odds.odd. But overall I wonder … a) Should be defining the content model of Schematron elements, or importing the Schematron schema? Interesting question: is there a Schematron schema that includes SQF? A quick search says yes, there is a schemas/ directory on the SQF GitHub site. However, the schemas therein are XSD. However, the comment in the XSD says it was converting with b) Surely not any Schematron element is allowed inside any SQF element, right? But I am not sure how to read the error message I got from oXygen; it may imply exactly that:
I understand the first two expected thingies, but can someone explain that WC construct? Also, the content of element |
OK. I’ve removed the extraneous Schematron 1.x bits from my local copy of p5odds.odd, but should I hold off on committing it until this problem is dealt with? (BTW, I have not just systematically nuked all Schematron NSs and looked for errors, because I am guessing that some occurrences are legit, and there are lots to look through. Over 330 occurrences in over 125 files. |
@sydb If you agree with my fix, that's two voices, so how about rolling it in with your changes and seeing what happens? |
Done at 1925b03. |
Great, so far so good for allowing SQF descendants of |
I see no objection myself; it would be good to have example use-cases though. |
One use-case could be the use of
The
I could just rework the jTEI ODD with some XSL elements (where it makes sense, of course), and see how it affects the build/validation process? |
That's a perfect example. |
Ok, done in #1742. Shall I leave additional changes in the ODD validation machinery to the experts? |
Someone from Council should OK the addition of the XSLT namespace elements, in case there's some issue I haven't thought of. We should hold off on committing the ODD changes till that's done, otherwise the ODD will be invalid. |
Council suggests we change the content of <alternate minOccurs="0" maxOccurs="unbounded">
<textNode/>
<anyElement/>
</alternate> Let's try this as an experiment and see if XSL is now permitted. If it works, let's go ahead and close this ticket. |
Committed at 6c508bd. I did get one weird message on my local build:
but was not able to figure out what it’s talking about. |
Sorry! Just merged. I did not work through the logic completely, but on first glance seems perfectly fine. @rvdb may want to tweak some more per my comment on the pull request. Does this mean we can close this ticket? |
The presence of xsl:key in tei_jtei.odd is still causing the P5-dev build to fail. More work needed here I think. |
Guess my thoughts, above, about doing the same in p5odds never made it in; done at 84e541c . |
Some Schematron rules require the use of
<xsl:variable>
when particular functionality is missing from a Schematron variable. One example involves testing whether Roman numerals in one element match a numerical value in a nearby attribute (for which one might wish to define an<xsl:variable>
to convert the value of the number into a Roman numeral using@format="I"
, which is unavailable in the Schematron variable).Schematron permits the embedding of xsl: variables in its syntax in a standalone file. However, if one attempts to write this in an ODD constraintSpec, it's flagged as an error because the descendant elements of
<constraint>
must all be defined in the sch: (Schematron) namespace. If one ignores the tei_odds schema error, one can output a Relax NG Schema in XML syntax that holds the Schematron rule with its variable, but it's apparently not fully functional in the Relax NG context: Schematron contexts and variables don't pass into the xsl:variable.I've made this work in my project by compiling the ODD schema without the rule with the xsl:variable, and just storing it in a separate Schematron file that I associate with the files that require Roman numeral checking. But it would be nice to see full functionality of Schematron in ODD, including embedded xsl that might reasonably be evoked in a Schematron file.
The text was updated successfully, but these errors were encountered: