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

RE: XML schema : refer problem

  • From: "Michael Kay" <mike@s...>
  • To: "'Geert Delanote'" <geert.delanote@g...>,<xml-dev@l...>
  • Date: Wed, 22 Apr 2009 14:57:15 +0100

RE:  XML schema : refer problem

Easy enough in XSD 1.1 (*)

On organisationType, define

xs:assert test="every $pp in ./person/poll satisfies
                 some $p in ./poll satisfies 
                    ($pp/@id = $p/@id
                      and every $a in $pp/answer satisfies $a/@id =
$p/question/@id)"

(*) Also easy to get it wrong - no guarantees offered!

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

> -----Original Message-----
> From: Geert Delanote [mailto:geert.delanote@g...] 
> Sent: 22 April 2009 14:13
> To: xml-dev@l...
> Subject:  XML schema : refer problem
> 
> Suppose I have the following document :
> <?xml version="1.0" encoding="UTF-8"?>
> <organisation>
> 	<person id="1">
> 		<poll id="a">
> 			<answer id="1"/>
> 			<answer id="3"/>
> 		</poll>
> 	</person>
> 
> 	<poll id="a">
> 		<question id="1"/>
> 		<question id="2"/>
> 	</poll>
> 	<poll id="b">
> 		<question id="1"/>
> 		<question id="3"/>
> 	</poll>
> </organisation>
> 
> In my schema definition i want the following constraints :
> - a poll has a unique id within an organisation : key on id 
> in organisation scope : No Problem
> - a question has a unique id within a poll : key on id in poll scope :
> No Problem
> - a person can only answer a defined poll : keyref to the key of poll
> : No problem
> - a person can only answer questions of the referenced poll : ...
> problem ... How do I do that? The combination poll-id 
> question-id is unique but I can't define a key on that 
> combination which I need to refer to.
> 
> Extra question : how can I ensure that the person answers 
> every question?
> The question element contains lots of information that I 
> don't want to duplicate...
> 
> ______________________________________________________________
> _________
> 
> 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@l...
> subscribe: xml-dev-subscribe@l... 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]


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.