- From: Hess Yvan <yvan.hess@imtf.ch>
- Date: Mon, 15 Mar 2004 17:26:45 +0100
- To: "'ht@inf.ed.ac.uk'" <ht@inf.ed.ac.uk>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
document is the root element of my XML document and it is for this reason I
choose "." as XPath expression of my key and I included it in my element
declaration as illustrated bellow:
<xs:element name="document">
<xs:complexType>
<xs:sequence>
<xs:element name="metadata" type="MetadataType"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string" use="required"/>
</xs:complexType>
<xs:key name="DocIdentifier">
<xs:selector xpath="."/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
Choosing <xs:selector xpath=".//my:document"/> as you recommended will not
work or I am wrong, am I? What is the solution in this context?
Regards. Yvan
-----Original Message-----
From: ht@inf.ed.ac.uk [mailto:ht@inf.ed.ac.uk]
Sent: lundi, 15. mars 2004 16:18
To: Hess Yvan
Cc: 'xmlschema-dev@w3.org'
Subject: Re: Impact of the usage of unique identifier as URN into XML
document s ?
Hess Yvan <yvan.hess@imtf.ch> writes:
> <xs:key name="DocIdentifier">
> <xs:selector xpath="."/>
> <xs:field xpath="@id"/>
> </xs:key>
This does not have the desired effect, it will always be true, as
there is only ever one id attribute on a 'document' element. To have
this do useful work, you need to change it to
<xs:key name="DocIdentifier">
<xs:selector xpath=".//my:document"/>
<xs:field xpath="@id"/>
</xs:key>
and move it to within an element declaration for an element which
scopes all your 'document' nodes.
> It works fine, but I don't know the future impacts/limitation of such
> choice, specially concerning the usage of URN as unique identifier in
> conjunction with others XML technologies. Does anybody have any comments,
> suggestions or best practices about this subject? Can you see future
> limitation?
I don't foresee any future problems with this -- the actual _type_ of
the attribute you call 'id' is completely within your control.
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged
spam]
Received on Monday, 15 March 2004 11:32:52 UTC