>I got a requirement where in i need to restrict the same attribute name to appear twice in xml file Do you mean you want it to appear exactly two times in different siblings named FilfilmentData or you do not want it to appear more than once...? I cannot make a clear deduction from what I read.
Well, your later thought is right ....you do not want it to appear more than once ....... and FullfilmentData is an element having Name and Value as attributes so I want Name attribute to be restircted for Uniqueness means it shouldn't be repeated!
hope I'm clear this time?
Joined: Jan 18, 2011
Thanks for the clarification. In that case, it is the classic use of xs:unique which it is designed for.
However, it is important to place it at the correct place. The main thing is that the xpath acceptable in the xs:selector and xs:field is not the full set of xpath as specified in the xpath recommendation. Only a fairly small subset is allowed (otherwise, if you place it your way, one might think of an axis back-tracking to the element's parent etc..., but that is not allowed.)
The place of it should appear in the container element of FulfilmentData. A typical structure, but not necessary being so, may look like this. (The "name_of_parent_to_FulfilmentData" is of course figurative, it is your actual name used.)