Re: Restricting a union? was RE: Schema for schemas bugs?

Hi Simon,

> Is it possible to derive a simpleType by restriction from a union
> simple type, such that the derived type selects just one of the
> primitivetypes from the union?

There's no way to explicitly say "restrict this union to this
particular type", but in some cases you could achieve the same result
by restricting the union using a pattern.

> For example, starting with a "supertype"
>
>   <simpleType name="TMDurationType">
>     <union memberTypes="duration positiveInteger double"/>
>   </simpleType>
>
> can this be restricted to "duration" only?  

So in this case you could use:

<xs:simpleType name="TMPeriodDurationType">
  <xs:restriction base="TMDurationType">
    <xs:pattern value="P.*" />
  </xs:restriction>
</xs:simpleType>

(You could make the pattern more detailed, but there's no real reason
to.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Friday, 26 April 2002 04:39:10 UTC