[oXygen-user] RelaxNG and Schematron

Christian Kosmowski
Tue Mar 10 05:26:06 CDT 2009


Hi there!

Due to some restrictions of XML Schema we are currently changing to
RelaxNG. I now tried to take some Schematron rules of the old schema and
put it in the new RelaxNG Schema to test if Schematron will work.

This is my "root" File which includes other RelaxNG Schemas:

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
  xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
  xmlns:sch="http://www.ascc.net/xml/schematron"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
  ns="http://www.docscape.de/layoutV4.2">

  <include href="layout_definitions.rng"/>
 
  <sch:pattern>
    <sch:rule context="//Regel[@datensatz and @name]">
      <sch:assert test="count(//Regel[@name=current()/@name and
@datensatz=current()/@datensatz]) le 1">Die Regel »<sch:value-of
select="@name"/>« zu dem Datensatz »<sch:value-of select="@datensatz"/>«
ist mehrfach vorhanden.</sch:assert>
    </sch:rule>
    <sch:rule context="//Regel[@datensatz and not(@name)]">
      <sch:assert test="count(//Regel[@datensatz=current()/@datensatz
and not(@name)]) le 1">Die Regel  zum Datensatz »<sch:value-of
select="@datensatz"/>« ist mehrfach vorhanden.</sch:assert>
    </sch:rule>
    <sch:rule context="//Regel[@name and not(@datensatz)]">
      <sch:assert test="count(//Regel[@name=current()/@name and
not(@datensatz)]) le 1">Die Regel »<sch:value-of select="@name"/>« ist
mehrfach vorhanden.</sch:assert>
    </sch:rule>
    <sch:rule context="//Zuweisung">
        <sch:assert test="(//DefVariable[@name=current()/@name]) or
exists(Name)">Variable »<sch:value-of select="@name"/>« nicht
definiert.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <start>
    <choice>
      <element name="Layout">
        <optional>
          <attribute name="version">
            <text/>
          </attribute>
        </optional>
        <optional><attribute name="datensatz"><text/></attribute></optional>
        <zeroOrMore>
          <interleave>
            <optional><ref name="g_Deklarationen"/></optional>
            <optional><ref name="g_Documentation"/></optional>
            <optional><ref name="x_Layoutinclude"/></optional>
          </interleave>
        </zeroOrMore>
      </element>
      <ref name="x_Layoutinclude"/>
    </choice>
  </start>
</grammar>

The're is just no effect to the validation. The rest of the Schema works
fine but the schematron rules have no effect. They seme to be ignored.

Any suggestions?

Thanks, Christian

-- 
QuinScape GmbH              
http://www.QuinScape.de
http://www.docscape.de




More information about the oXygen-user mailing list