[relaxng-user] (no subject)

Steve Drach drach at eng.sun.com
Fri Jan 9 12:22:22 ICT 2004


I'm trying to define an attribute that can have a list of one or more (up
to three) mutually exclusive values.  For example, all the following are
valid:

<test state="hide"/>
<test state="hide enable"/>
<test state="hide enable lower"/>
<test state="show raise"/>
<test state="raise show"/>

But these are not valid:

<test state="hide show"/>
<test state="hide enable disable"/>
<test state="hide enable show"/>

So, I tried to specify the element and attribute as follows:

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
    <ref name="test"/>
  </start>
  <define name="test">
    <element name="TEST">
      <attribute name="state">
        <interleave>
          <choice>
            <value>hide</value>
            <value>show</value>
          </choice>
          <choice>
            <value>enable</value>
            <value>disable</value>
          </choice>
          <choice>
            <value>raise</value>
            <value>lower</value>
          </choice>
        </interleave>
      </attribute>
    </element>
  </define>
</grammar>

However, when I run jing on this to verify it, I get the following
message:

test.rng:8:31: error: interleave of "string" or "data" element

I'm not quite sure what I'm doing wrong here.  Hopefully someone
will educate me.  Secondly, since this is wrong, is there a way
to correctly specify this?



More information about the relaxng-user mailing list