[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSD 1.1 - assert a condition of a complex type depending o

  • From: "Michael Kay" <mike@saxonica.com>
  • To: 'Maik St?ührenberg' <maik.stuehrenberg@uni-bielefeld.de>
  • Date: Fri, 23 Oct 2009 10:18:34 +0100

RE:  XSD 1.1 - assert a condition of a complex type depending o
> 
> 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)"

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.