Selecting current node in <keyref>
Question posted by: Kent Boogaart
(Guest)
on
November 12th, 2005 05:09 AM
Hi,
Suppose an XSD as follows:
<xsd:complexType name="myType">
<xsd:complexContent>
<xsd:extension base="myBaseType">
<xsd:sequence>
<xsd:element name="thing" minOccurs="0"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"
use="required"/>
</xsd:complexType>
<xsd:keyref name="myKeyRef" refer="someKey">
<xsd:selector xpath="???"/>
<xsd:field xpath="@id"/>
</xsd:keyref>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
This type would be used something like this:
<myBaseType xsi:type="myType">
<thing id="thing1"/>
<thing id="thing2"/>
</myBaseType>
What I'm trying to do is ensure that the ID specified is valid as defined by
the "someKey" key (which is defined in another schema along with the base
type). The problem is that the <keyref> must appear where I have it above
but I can't figure out how to select the current node. I tried "." along
with other things for the XPath expression but they didn't seem to work.
I can't put the <keyref> anywhere since it is specific to the "myType" type
which has to be in its own schema.
Any ideas?
Thanks,
Kent
0
Answers Posted
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,828 network members.
Top Community Contributors
|