Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Relax NG:table [Thread Next] Re: Relax NG:tableTo: NULL Date: 2/1/2006 1:36:00 AM You can use Schematron embedded rules for that. See below a full
sample:
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:sch="http://www.ascc.net/xml/schematron">
<start>
<element name="table">
<oneOrMore>
<element name="column">
<sch:pattern name="Check to have the same number of cells in
each column" id="cells">
<sch:rule context="column">
<sch:assert test="count(../column[1]/cell) =
count(cell)">The number of cells in this
column should be the same as in the firtst column,
expected <sch:value-of
select="count(../column[1]/cell)"/> but got
<sch:value-of select="count(cell)"/>.
</sch:assert>
</sch:rule>
</sch:pattern>
<oneOrMore>
<element name="cell">
<empty/>
</element>
</oneOrMore>
</element>
</oneOrMore>
</element>
</start>
</grammar>
On your second document (after you make it wellformed) you will get:
The number of cells in this column should be the same as in the firtst
column, expected 2 but got 1 . (count(../column[1]/cell) = count(cell))
Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
