@rowspan not found by Schematron rule in oXygen

Questions about XML that are not covered by the other forums should go here.
MaryS
Posts: 2
Joined: Thu Jul 06, 2017 5:46 pm

@rowspan not found by Schematron rule in oXygen

Post by MaryS »

Hi
Given the following XML (I'm validating against JATS 1.1 Archiving DTD):
...
<thead>
<tr>
<th rowspan="2">Year</th>
<th colspan="6" rowspan="1">
<italic>n</italic> (&#x0025;) by LFA</th>
<th rowspan="2">Overall</th>
</tr>
...

I have the following Schematron rule to check for the presence of @rowspan on <th>:

<sch:rule context="th[@rowspan]">
<sch:report test="true()">Don't use the rowspan attribute</sch:report>
</sch:rule>

However, this rule finds ALL <th>, not just those with @rowspan. For some odd reason, the same rule re-written as

<sch:rule context="th[@align]">
<sch:report test="true()">Don't use the align attribute</sch:report>
</sch:rule>

will successfully find ONLY those <th> with @align or @colspan, so this problem seems limited to @rowspan only. The same problem exists for evaluating @rowspan on <td>. I am using oXygen V 19 for PC. Note that there are no competing rules with the same context.

Is this a bug? I had the same problem in oXgen v 18.

Any advice appreciated.
Last edited by MaryS on Thu Jul 06, 2017 6:41 pm, edited 1 time in total.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: @rowspan not found by Schematron rule in oXgen

Post by adrian »

Hi,

Note that in JATS 1.1 @rowspan and @colspan are default attributes (declared in the DTDs) for the th element.
You can check this in Oxygen, place the cursor inside the th element and have a look in the Attributes view. Even for th elements without explicit @rowspan and @colspan attributes in the XML you will still see them in the Attributes view with the default values of "1".

In short, all th elements have @rowspan and @colspan attributes, not just those that specify them explicitly, so the Schematron rule can't be used this way.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
MaryS
Posts: 2
Joined: Thu Jul 06, 2017 5:46 pm

Re: @rowspan not found by Schematron rule in oXygen

Post by MaryS »

OK that is good to know. But should I not then be able to test for th[@rowspan='2'], since this is not the default value? I have tried this actually, and it has no effect.
tavy
Posts: 364
Joined: Thu Jul 01, 2004 12:29 pm

Re: @rowspan not found by Schematron rule in oXygen

Post by tavy »

Hello,

Yes, you can use th[@rowspan='2']. For me it works fine. You can also report a problem only when the value of the rowspan is different from the default one. Something like this:

Code: Select all


<sch:rule context="th[@rowspan!='1']">
<sch:report test="true()">Don't use the rowspan attribute</sch:report>
</sch:rule>
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply