@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

@rowspan not found by Schematron rule in oXygen

Thu Jul 06, 2017 6:01 pm

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: 2326

Re: @rowspan not found by Schematron rule in oXgen

Thu Jul 06, 2017 6:26 pm

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

Re: @rowspan not found by Schematron rule in oXygen

Thu Jul 06, 2017 6:45 pm

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: 122

Re: @rowspan not found by Schematron rule in oXygen

Fri Jul 07, 2017 11:50 am

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

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest