Schematron and Oxygen 22.0

This should cover W3C XML Schema, Relax NG and DTD related problems.
david_himself
Posts: 25
Joined: Mon Oct 01, 2018 7:29 pm

Schematron and Oxygen 22.0

Post by david_himself » Tue Apr 07, 2020 4:13 pm

Hi

I've just started with ODD containing some elementary Schematron, generating a Relax NG XML file for validation of our TEI/XML files. For four members of our team the schema seems to work fine, but for one colleague, two rules in particular fire wrongly or fail to fire. We haven't spotted any difference in settings, but she's on vsn 22.0, while we're all on 21.1.

The prologue and start of the ODD file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:rng="http://relaxng.org/ns/structure/1.0" xml:lang="en" xmlns:sch="http://purl.oclc.org/dsdl/schematron">
<teiHeader>
...

The misfiring rules look like this:

<elementSpec ident="p" module="core" mode="change">
<constraintSpec ident="header" scheme="schematron">
<constraint>
<sch:report test=".[@*]/ancestor::tei:teiHeader" role="error">A paragraph &lt;p&gt; in the header must not have any attributes.</sch:report>
<sch:report test=".[not(@rend)]/ancestor::tei:text" role="error">A paragraph &lt;p&gt; in the text portion must have the attribute rend.</sch:report>
<sch:report test="not(@rend='inline') and ./preceding-sibling::tei:label" role="warning">When the content of a postscript follows the &apos;P.S.&apos; label on the same line, its obligatory &lt;p&gt; would normally have @rend with value &quot;inline&quot;.</sch:report>
</constraint>
</constraintSpec>
...
</elementSpec>

Of the three reports for <p>, the first throws an error for the colleague on 22.0 for every paragraph in the teiHeader, even though all are correctly written without an attribute; the second doesn't fire and allows <p> with or without @rend; while the third works as intended. All the other Schematron rules work fine for her as for us.

Any ideas where to look? Does the ODD need changing, or is there a setting in Oxygen we need to look at? Thanks for any help.
best
David

Radu
Posts: 7212
Joined: Fri Jul 09, 2004 5:18 pm

Re: Schematron and Oxygen 22.0

Post by Radu » Wed Apr 08, 2020 12:18 pm

Hi David,

In the Oxygen Preferences->"XML / XML Parser / RELAX NG" page there is an "Add default attributes" checkbox, if checked it will provide the support to expand default attributes (defined in the RNG) in the parsing stage, making it possible for the Schematron to match attributes which are not actually in the xml docs. Usually for TEI editing you should disable that checkbox.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

david_himself
Posts: 25
Joined: Mon Oct 01, 2018 7:29 pm

Re: Schematron and Oxygen 22.0

Post by david_himself » Wed Apr 08, 2020 1:06 pm

Thanks, Radu. Unchecking that option fixed the problem for my colleague. I don't think the rest of us had it checked. I'm going to get rid of most or all default choices in the schema anyway, as they don't really help.

best
David

Post Reply