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

Problem with tei_customization Schematron #1950

Closed
martindholmes opened this issue Dec 5, 2019 · 1 comment
Closed

Problem with tei_customization Schematron #1950

martindholmes opened this issue Dec 5, 2019 · 1 comment

Comments

@martindholmes
Copy link
Contributor

martindholmes commented Dec 5, 2019

The XSLT which generates the tei_customization.odd file has a problem starting here:

<sch:let name="exceptions" value="tokenize( ., '\s+' )"/>

If you use the schema in Oxygen to validate a file, you'll get an error as soon as Oxygen tries to compile the Schematron from the RNG file to XSLT in the background. The error is:

Errors were reported during stylesheet compilation
Variable exceptions has not been declared (or its declaration is not in scope)

I think the reason is that the Schematron rule is being created here in the context of the <attDef> of @except, and this line tries to execute in that context:

<sch:let name="exceptions" value="tokenize( ., '\s+' )"/>

I have a suspicion that such an expression can only be executed in the context of an element, not an attribute, so the variable doesn't get created properly and the subsequent operations relying on it fail. I think in the RNG it ends up being in the context of the parent <moduleRef> element.

Assigning this to @sydb because he'll know exactly what to do. To test the fix, commit, wait for the build process to complete through to the bleeding-edge plugin, update your plugin, then create a File / New using the TEI for TEI Customizations template, and validate the resulting file.

@martindholmes
Copy link
Contributor Author

@sydb and I working on this today discovered three constraints defined in the context of attDefs in this schema. We checked the Schematron specification, and there is definitely nothing wrong with this:

The rule context is interpreted according to the Production 1 of XSLT1. The rule context may be root nodes, elements, attributes, comments and processing instructions. An implementation may allow the rule context to be text nodes at user option however implementations may reject or fail to implement schemas which specify text nodes.

However, the TEI Stylesheets don't handle this in the expected way; they hoist the constraint to the next level (in the case of this @except attribute, the parent <moduleRef> definition). So that Stylesheets problem does need to be fixed. However, for the moment, moving the constraints manually will make this particular schema work. We should either:

  1. Decide that in the context of a TEI ODD, we only want constraints at the root level or at the <*Spec> level, and enforce that in the schema; or

  2. Fix the Stylesheets so that they're able to keep constraints in their original location in the output RELAX NG.

@sydb sydb closed this as completed in 51f6d56 Dec 6, 2019
@martinascholger martinascholger added this to the Guidelines 3.7.0 milestone Feb 3, 2020
hcayless pushed a commit that referenced this issue Jun 26, 2022
* Move the constraint specification for "need-required", which tests `@except`, from inside the `<attDef>` for `@except` up one level into the `<elementSpec>` for `<moduleRef>`. This is a work-around, but it works perfectly well and is not actually problematic. Nonetheless, we should file a ticket against the Stylesheets so that the Schematron constraints expressed inside an `<attDef>` get expressed in the RELAX NG inside the corresponding `<attribute>`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants