Schematron position() bug
Posted: Wed Jan 26, 2005 6:41 am
It seems that the Schematron validation included with oXygen has a bug involving XPath tests with position().
Consider this sample XML file:
I want to enforce a rule that every row must have an @n attribute containing the row number. This Schematron rule should do it:
But it does not work under oXygen 5.1 (OS X version). All the rows fail.
After some experiment, I discovered that the rows all return true() for the tests if I change
to
So it seems that the true position is being multiplied by 2 somewhere in the underlying Schematron code.
I tested this data and my original Schematron rule using Jing (version 20030619) and it performed as expected.
Then I downloaded the Skeleton 1.5 files from http://xml.ascc.net/schematron/1.5/ and tried running the code using a command-line XSLT processor. This produced the bug also. But I can't figure out where the problem is in Skeleton.
Since oXygen already comes with Jing, maybe Jing could be used for the Schematron support? See:
http://www.thaiopensource.com/relaxng/jing-other.html
Consider this sample XML file:
Code: Select all
<test>
<table>
<row n="1">
<cell>one</cell>
<cell>two</cell>
</row>
<row n="2">
<cell>un</cell>
<cell>deux</cell>
</row>
<row n="3">
<cell>uno</cell>
<cell>dos</cell>
</row>
</table>
</test>
Code: Select all
<sch:rule context="row">
<sch:assert test="@n and ( position() = @n )">Each row should be
numbered sequentially using the @n attribute</sch:assert>
</sch:rule>
After some experiment, I discovered that the rows all return true() for the tests if I change
Code: Select all
position() = @n
Code: Select all
position() = @n* 2
I tested this data and my original Schematron rule using Jing (version 20030619) and it performed as expected.
Then I downloaded the Skeleton 1.5 files from http://xml.ascc.net/schematron/1.5/ and tried running the code using a command-line XSLT processor. This produced the bug also. But I can't figure out where the problem is in Skeleton.
Since oXygen already comes with Jing, maybe Jing could be used for the Schematron support? See:
http://www.thaiopensource.com/relaxng/jing-other.html