Re: List of numeric and enumerated values problem

You've got (almost) the the right building blocks, but need to combine
them in a different order!

Instead of creating an union of lists that allows only a (list of Score)
or a (list of NoScore), you need to create a list of unions that allows
a list of (either Score or NoScore) :=) ...

<X:simpleType name="Score">
  <X:restriction base='X:integer'>
    <X:maxInclusive value='50'/>
    <X:minInclusive value='5'/>
  </X:restriction>
</X:simpleType>

<X:simpleType name="NoScore">
  <X:restriction base='X:NMTOKEN'>
    <X:enumeration value='none'/>
  </X:restriction>
</X:simpleType>

<X:simpleType name="ScoreAndNoScore">
  <X:union memberTypes="A:Score A:NoScore"/>
</X:simpleType>

<X:simpleType name="ScoreAndNoScoreList">
  <X:list itemType="A:ScoreAndNoScore"/>
</X:simpleType>

should work.

Hope this helps.

Eric
Neil Bradley wrote:
> 
> I am trying to create a list type that allows scores, which are values
> between 5 and 50, to be created, such as '50 23 9 22', and mixed with a the
> keyword 'none' to represent no score. For example, '23 none 5 7 none 45':
> 
> First I defined the Score type allowing such scores as '23':
> 
> <X:simpleType name="Score">
>   <X:restriction base='X:integer'>
>     <X:maxInclusive value='50'/>
>     <X:minInclusive value='5'/>
>   </X:restriction>
> </X:simpleType>
> 
> Then I create a list type for score, ScoreList, so allowing '50 23 22 9':
> 
> <X:simpleType name="ScoreList">
>   <X:list itemType="A:Score"/>
> </X:simpleType>
> 
> Then I create the NoScore type, which allows the keyword 'none' only:
> 
> <X:simpleType name="NoScore">
>   <X:restriction base='X:NMTOKEN'>
>     <X:enumeration value='none'/>
>   </X:restriction>
> </X:simpleType>
> 
> Then I create a list for type NoScore, called NoScoreList, so allowing 'none
> none none':
> 
> <X:simpleType name="NoScoreList">
>   <X:list itemType="A:NoScore"/>
> </X:simpleType>
> 
> Finally, I try to create union of the two list types, so I can have '23 none
> 5':
> 
> <X:simpleType name="ScoreAndNoScore">
>   <X:union memberTypes="A:ScoreList A:NoScoreList"/>
> </X:simpleType>
> 
> But it does not work. I can have 'none none none', or '5 6 7', but no
> combination of the two
> 
> I thought maybe I should create a new list type, but the following addition
> causes an error:
> 
> <X:simpleType name="ScoreAndNoScoreList">
>   <X:list itemType="A:ScoreAndNoScore"/>
> </X:simpleType>
> 
> Any ideas how to do this?
> 
> Neil.

-- 
See you at XTech in San Diego.
             http://conferences.oreillynet.com/cs/os2001/view/e_spkr/790
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------

Received on Thursday, 5 July 2001 09:39:51 UTC