I want to be able to guarantee uniqueness for two types of elements : MainQuestion and AlternateQuestion. In the select query for my xsd:key, can I specify something that would do "//MainQuestion or //AlternateQuestion"? Someone told me that something like this existed, but it seems that XSD only supports a subset of the XPath syntax...
A:
Do you have tried the or ? http://w3schools.com/xpath/xpath_operators.asp
mere-teresa
2009-08-05 15:04:43
+2
A:
You should be able to use |
as usual:
//MainQuestion | //AlternateQuestion
the syntax is indeed restricted - it is roughly the same as restrictions for template patterns in XSLT 1.0, but in addition to that it cannot have any filters in path steps. However, |
is explicitly listed as supported.
Pavel Minaev
2009-08-05 22:22:29
thanks for your response, I don't know how I didn't find that myself, that was pretty easy...
lau
2009-08-06 10:22:06
+1
A:
Supporting Pavel's answer that you can use "|" in an XPath in XML Schema.
XML Schema supports a subset of XPath (which I think of as "fake XPath"). What it supports is explicitly stated in the spec. You have to trace through a few sections to find it. This is a link to the exact section:
13ren
2009-08-06 04:01:52