[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Schema restriction between attributes


Subject: [xsl] Schema restriction between attributes
From: "Eran Hammer-Lahav" <xalan@xxxxxxxxx>
Date: Fri, 30 May 2003 16:33:54 -0400

Is there a way in a schema to specify restrictions on one attribute if
another has a certain value? Here is an example:

<?xml version="1.0" ?>
<xs:schema id="x" targetNamespace="x" xmlns:x="x"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0">
 <xs:element name="structure">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="field" minOccurs="0" maxOccurs="unbounded">
     <xs:complexType>
      <xs:attribute name="name" type="xs:string" use="required" />
      <xs:attribute name="type" type="omm:memberType" use="required" />
	<xs:attribute name="typeName" type="xs:string" use="optional" />
     </xs:complexType>
    </xs:element>
   </xs:sequence>
   <xs:attribute name="class" type="xs:string" use="required" />
   <xs:attribute name="dbTable" type="xs:string" use="required" />
  </xs:complexType>
 </xs:element>
</xs:schema>

I want that if structure/@type = 'enum', structure/@typeName will not be
empty. Is there a way to achieve this in the schema? I know I can do this in
the xslt script, by check each value and using the <xsl:message> message to
end execution, but I would like to have the schema control this.

Thanks.

EL



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords