Let's say I have an XML file that will look like this:
<a>
<b d="value1"/>
<c d="value2"/>
</a>
In the XSD file that defines the structure of this XML file I defined the elements by name 'b' and 'c' to be of the same type (and the type requires attribute 'd').
Let's say that I want to make a keyReference of all elements of the type that both 'b' and 'c' are, is there any way in XPath to do this?
At the definition of the type of 'a' I would expect something like this:
<xs:keyref name="myReferenceName" refer="keyToReferTo">
<xs:selector xpath="[@type='typenameof elements b and c?']"/>
<xs:field xpath="@d"/>
</xs:keyref>
Is something like this possible, or is XPath, even in the XSD, schema-unaware?
XPath 1.0 is certainly not aware of any schemas and the W3C XML schema specification in version 1.0 even only uses a subset of XPath 1.0.
I think there is work going on to define a new version of the W3C XML schema language that uses XPath 2.0 but I have no idea about its details and whether it allows then to select elements in a selector based on schema types.
The XPath would be element(*, NameOfTypeGoesHere)
I think, see http://www.w3.org/TR/xpath20/#id-element-test