Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Relax NG:table

From: "George Bina" <george@---------.--->
To: 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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent