|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: <selector xpath="."/> doesn't work
Michael, thanks, I see what you are saying and it sounds rational. But at the same time I have seen quite a few examples in books about XML Schema that are using the selector xpath="." element. Can it be that it works with keyref but not with key? I just can't believe that all the books are wrong ... Markus > Start with an English sentence: "every building on the campus can be > referred to by its buildingCode". Then define a key on the campus > element with a "selector" that identifies the buiding element, and a > "field" that identifies the buildingCode of that building. > > Using a selector of "." means "every building in the building can be > referred to..." which doesn't make much sense. > > Michael Kay > > > -----Original Message----- > > From: Markus Seibold [mailto:Markus.Seibold@g...] > > Sent: 17 February 2004 13:50 > > To: xml-dev@l... > > Subject: <selector xpath="."/> doesn't work > > > > > > Hello, > > I am using <key> and <keyref> in my XML Schema. > > > > When I declare the <key> element globally > > ('AdminUnitKey_Global'), the key's are set appropriatly. > > > > When I want to declare the <key> element locally > > ('AdminUnitKey_Local'; by using the expression <selector > > xpath="."/ under the <AdminUnit> element) the key is not set > > and the schema does not validate because the <keyref> fails > > to refer to some key. > > > > I thought that xpath="." refers to the current element where > > the xpath expression is set? Why doesn't that work with <key>? > > > > Thanks, Markus > > > > <?xml version="1.0" encoding="UTF-8"?> > > <schema targetNamespace="http://www.opentourism.org" > > xmlns="http://www.w3.org/2001/XMLSchema" > > xmlns:utour="http://www.opentourism.org" > > elementFormDefault="unqualified"> > > <element name="Country"> > > <complexType> > > <sequence> > > <element name="CountryID" > > type="string"/> > > <element name="AdminUnit" > > minOccurs="0" maxOccurs="unbounded"> > > <complexType> > > <sequence> > > > > <element name="AdminUnitName" type="string"/> > > > > <element name="SubAdminUnits" minOccurs="0" maxOccurs="unbounded"> > > > > <complexType> > > > > <sequence> > > > > <element name="SubAdminUnitName" type="string"/> > > > > </sequence> > > > > </complexType> > > </element> > > </sequence> > > </complexType> > > <!-- > > <key name="AdminUnitKey_Local"> > > <selector xpath="."/> > > <field > > xpath="AdminUnitName"/> > > </key> > > <keyref > > name="AdminUnitRef_Local" refer="utour:AdminUnitKey_Local"> > > <selector > > xpath="SubAdminUnits"/> > > <field > > xpath="SubAdminUnitName"/> > > </keyref> > > --> > > </element> > > </sequence> > > </complexType> > > <key name="AdminUnitKey_Global"> > > <selector xpath="AdminUnit"/> > > <field xpath="AdminUnitName"/> > > </key> > > <keyref name="AdminUnitRef_Global" > > refer="utour:AdminUnitKey_Global"> > > <selector xpath="AdminUnit/SubAdminUnits"/> > > <field xpath="SubAdminUnitName"/> > > </keyref> > > </element> > > </schema> > > > > -- > > Markus Seibold > > ------------------------------ > > Krebsgasse 6 > > D-93047 Regensburg > > Germany > > ------------------------------ > > Email: markus.seibold@g... > > Phone: +49 (941) 504 1009 > > Mobile: +49 (171) 212 6869 > > FAX: +49 (89) 1488 210457 > > > > > > ----------------------------------------------------------------- > > The xml-dev list is sponsored by XML.org > > <http://www.xml.org>, an initiative of OASIS > <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://www.oasis-open.org/mlmanage/index.php> > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://www.oasis-open.org/mlmanage/index.php> > -- Markus Seibold ------------------------------ Krebsgasse 6 D-93047 Regensburg Germany ------------------------------ Email: markus.seibold@g... Phone: +49 (941) 504 1009 Mobile: +49 (171) 212 6869 FAX: +49 (89) 1488 210457
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








