views:

29

answers:

2

Is it possible in xsd to create restriction based on elements of some type in target (processed) document?

For example I have XML like this:

<Pets>
 <Pet name="Murka" />
 <Pet name="Browko" />
 <Pet name="Tuzik" />
</Pets>

<Children>
 <Child name="Petruk" favoritePet="Browko" />
</Children>

so what I want to restrict the attribute "favoritePet" of element "Child" based on existing "Pet" elements. How can I do this?

A: 

No, with the current XSD 1.0 specifications, you cannot do these kind of dependencies.

Should XSD 1.1 become a reality, then yes, that would support these kind of "assertions" - but I don't think anyone supports and uses XSD 1.1 at this time.

marc_s
A: 

I found that "keyref" is an answer to my question :) It is solved now. Here is the resource.

Сергій
ur link is dead!
infant programmer