Jump to content
Sign in to follow this  
RobertB

conditional validation

Recommended Posts

Hi,Does anybody know of an easy way in a XSD to have a validation based on an attribute from the parent node ?My XML: .... <product no="218"> <part type="é" /> </product> <product no="205"> <participant>N</participant> <part type="é"> <nb>1</nb> </part> </product>...In the XSD:...<xs:element name="participant" minOccurs="0" maxOccurs="1">...<xs:element name="part" minOccurs="1" maxOccurs="12">The tag participant can only occur if the product no is 205, and the maxOccurs of product no 218 is 12 where is really is 10 for product no 205.How can I do this ? I really need both to be under the "product tag", so I cannot change its name.Thank's for help !

Share this post


Link to post
Share on other sites

The only way I can think of would be for an XSLT that would create a schema from a predefined XML source that would serve as a model to the schema. In the XSLT you have IFs and CHOOSEs, so it sounds plausable. If there is a way with Schema itself, I don't know of it.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...