[xsl] Schema problem: different element types with the same name

Subject: [xsl] Schema problem: different element types with the same name
From: Sascha Mantscheff <922492@xxxxxx>
Date: Thu, 06 Dec 2007 15:07:07 +0100
I accidentally sent this question as an reply to another topic.
Therefore I will repeat it here as a separate topic.
I'm dealing with some legacy XML documents and try to develop a schema
to validate them.

They contain sequences like:

  <mmc:param name="asp.frameset">view-book</mmc:param>
  <mmc:param name="suppress.index.list.when.no.input">0</mmc:param>

The first element content must be name token (without spaces), the
second a boolean value. My first try was to define two separate types
and to apply then to the param element, like in the example below. But
obviously I cannot have two elements with the same name and different
types in a sequence. Is there a work-around?

I know that those elements should better be attributes. But changing the
legacy code before verifying it is not an option. I could also relax the
type and code both param elements as type string, but then I could not
verify the element content. How should I proceed?

<xs:complexType name="paramAspFrameset" mixed="true">
    <xs:extension base="xs:NMTOKEN">
      <xs:attribute name="name" fixed="asp.frameset" use="required"/>

<xs:complexType name="paramSuppressIndexListWhenNoInput" mixed="true">
    <xs:extension base="xs:boolean">
      <xs:attribute name="name"

<xs:complexType name="text2index">
    <xs:element name="param" type="mmc:paramAspFrameset" 
      minOccurs="1" maxOccurs="1"/>
    <xs:element name="param"
      type="mmc:paramSuppressIndexListWhenNoInput" minOccurs="1"

Current Thread