fr21
fr21

Reputation: 1806

Reference to parent node in XSD?

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.

Upvotes: 2

Views: 973

Answers (3)

grantwparks
grantwparks

Reputation: 1153

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.

Upvotes: 1

Scott Baker
Scott Baker

Reputation: 10443

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.

Upvotes: 0

VolkerK
VolkerK

Reputation: 96159

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.

Upvotes: 1

Related Questions