In XSD i have one element x which takes values (a,b)
There is another element y
Is there any way using XSD so that i can make y as mandatory when value of x
Have a look at XML Schema Part 0: Primer Second Edition, section 2.2.1 Occurrence Constraints.
It says:
In general, an element is required to appear when the value of minOccurs is 1 or more. The maximum number of times an element may appear is determined by the value of a maxOccurs attribute in its declaration. This value may be a positive integer such as 41, or the term unbounded to indicate there is no maximum number of occurrences. The default value for both the minOccurs and the maxOccurs attributes is 1.
Because an attribute value cannot be deduced from other schema content in XML Schema, what you want to achieve is impossible (with XML Schema).
(I don't know if Relax NG can do this, but you may investigate if it supports such content-dependent definitions.)