[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: determining ID-ness in XML
> > / descendants-or-self::*[attval::*[local-name() = 'id'] = 'foo'][1] > > > > An inelegant solution to be sure. (Though this is basically > > what I always do anyway when I need to identify IDs, since > > in practice it's more reliable than anything else.) > > This was looked at. And existing DTDs with id attributes not of type > ID seems to exist. This totally break them, and make pointing unreliable > because a lot of tools expects #foo to point to the ID of name foo, and > you could actually end up pointing to a different part of the document > against the author(s) intent. Compatibility with the XPath id() function > was considered really important too. > > Daniel > A version of the definition that would address both those concerns is: #foo means: id('foo')|/*[not(id('foo'))]/descendant-or-self::*[@*[local-name()='id' and . = 'foo']][1] ie, use (the first) element node with ID 'foo' if one exists otherwise use the first element node with an attribute in any (or no) namespace with local name 'id' and value 'foo'. This does have some advantages in that like the Xpath id() function it doesn't impose any requirememts on the parsers to check any new kind of uniqueness constraint, and so doesn't require changes to current systems (except systems implementing fragment id's pointing to xml files, and these are rather thin on the ground, currently). David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service.
|
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
|