[relaxng-user] Trang problems with interleave

Manuel González Castro iinmgc00 at ucv.udc.es
Thu Oct 23 16:06:13 ICT 2003


Hello,

I haven't found any Trang mailing list so decided to I post my problem here.

I'm using Trang (version 20030619) to translate my Relax NG schemas to XML
Schemas. I've found that <interleave> element translation works fine if the
patterns inside are elements, but fails if the patterns use definitions.  

This is an example:

--------------------- input file: test.rnc ------------------------

start = element dummy { empty }

# Trang works OK
interleave_without_definitions =
  element test {
    element e1 { empty }
    & element e2 { empty }?
  }

# Trang fails
def1 = element e1 { empty }
def2 = element e2 { empty }
interleave_with_definitions =
 element test { def1  & def2 ? }

--------------------- output file: test.xsd ------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"> <xs:element name="dummy">
    <xs:complexType/>
  </xs:element>
  <!-- Trang works OK -->
  <xs:group name="interleave_without_definitions">
    <xs:sequence>
      <xs:element name="test">
        <xs:complexType>
          <xs:all>
            <xs:element ref="e1"/>
            <xs:element minOccurs="0" ref="e2"/>
          </xs:all>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:group>
  <xs:element name="e1">
    <xs:complexType/>
  </xs:element>
  <xs:element name="e2">
    <xs:complexType/>
  </xs:element>
  <!-- Trang fails -->
  <xs:group name="interleave_with_definitions">
    <xs:sequence>
      <xs:element name="test">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="e1"/>
            <xs:element ref="e2"/>
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:group>
</xs:schema>

As you can see, "interleave_without_definitions" uses xs:all (fine) but
"interleave_with_definitions" uses "xs:choice" (wrong). 

I need definitions in my schema.
Is there any workarround to this problem ?

Thanks in advance,
Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://relaxng.org/pipermail/relaxng-user/attachments/20031023/f7532d92/attachment.htm


More information about the relaxng-user mailing list