tags:

views:

146

answers:

3

Hi

In current w3c version of XSD, is there a way to refer to parent node or child node, when defining rules for a particular node?

To make it more clear, can i add a rule in child node that compares the parent node value and vice versa?

Thanks & Regards, Pavan.

A: 

The subset of XPath used in XSD 1.1's xs:alternative is limited to the attribute axis of the current element. And I don't see what else you could use.

VolkerK
A: 

XSD's start at the document level element, and define what children or attributes are allowed for each element.

So your answer is yes - you can define the child elements, but no - you cannot define the parents.

ScottSEA
+1  A: 

Are you wanting to do some kind cross-element validation, in which one element's schema depends on the value of another?

Maybe there's a way you can define alternatives at the parent element level.

grantwparks