XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XSD 1.1 - assert a condition of a complex type dependingon another element's attribute value

Michael Kay schrieb:
>> So the correct assert would be inside the cd element:
>>
>> <xs:element name="cd">
>>     <xs:complexType>
>>       <xs:sequence>
>>         <xs:element ref="pd" minOccurs="1" maxOccurs="unbounded"/>
>>         <xs:element ref="segs"/>
>>       </xs:sequence>
>>       <xs:assert test="pd/@start le segs/s/@start"/>
>>       <xs:assert test="pd/@end ge segs/s/@end"/>
>>     </xs:complexType>
>>   </xs:element>
>>
> 
> Shouldn't it be something like
> 
> test="every $s in segs/s/@start satisfies pd/@start le $s"
> 
>> In addition the problem with that solution is that the error 
>> is raised for the common ancestor which makes it much harder 
>> to inspect the wrong s element (if I imagine hundreds of s 
>> elements and only one is wrong...)
> 
> Yes. Saxon supports a coding convention here: if you write the assertion as
> an "empty()" predicate, and the result isn't empty, Saxon will tell you
> where the nodes were that were found. Something like:
> 
> test="empty(for $p in pd/@start, $s in segs/s[$p le @start] return $s)"

Perfect. This works like a charm. Again, thank you very much.

Best,

Maik St├╝hrenberg
> 
> Regards,
> 
> Michael Kay
> http://www.saxonica.com/
> http://twitter.com/michaelhkay 
> 
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 
> 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS