On Tue, May 4, 2010 at 2:27 PM, yoann moranville <yoann.moranvi...@gmail.com> wrote: > So actually, the only way I made it work for me, is to create a new (3rd) > alternative rule: > <xs:alternative test="(@attribute ne 'value1') and (@attribute ne 'value2')" > type="myElement.error" />
It seems to me, that a more appropriate way to define type alternatives for this example, is perhaps like, following: <xs:element name="myElement"> <xs:alternative test="@attribute = 'value1'" type="myElement.value1" /> <xs:alternative test="@attribute = 'value2'" type="myElement.value2" /> <xs:alternative type="xs:error" /> </xs:element> With an element definition like above, if 1st two XPath expressions evaluate to false, the element would become invalid (because, it then maps to type, xs:error). Whereas, if the 3rd alternative also has a test attribute (which you've specified in your example), and all type alternatives evaluate to false, then the element get's the default type for the element (which in this case is, xs:anyType -- and therefore, the element will be valid in this case, if all alternatives would evaluate to false). -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org