[
Lists Home |
Date Index |
Thread Index
]
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@gmx.net]
> > Sent: 17 February 2004 13:50
> > To: xml-dev@lists.xml.org
> > Subject: [xml-dev] <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@gmx.net
> > 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@gmx.net
Phone: +49 (941) 504 1009
Mobile: +49 (171) 212 6869
FAX: +49 (89) 1488 210457
|