Hi, Ben.
"ben Dave" <[EMAIL PROTECTED]> wrote on 2007-08-13 05:42:19 AM:
> I have several nodes within the same xml document that have the same ID.
> However, when attempting to select them in a list, only one node is
returned.
>
> NodeList node = XPathAPI.selectNodeList(document, "id('myID')");
>
> Is this a bug or is this the intended behaviour, is there another
> way of getting the desired result ?
This is the expected behaviour. According to section 5.2.1 of XPath
1.0[1], "An element node may have a unique identifier (ID). This is the
value of the attribute that is declared in the DTD as type ID. No two
elements in a document may have the same unique ID. If an XML processor
reports two elements in a document as having the same unique ID (which is
possible only if the document is invalid) then the second element in
document order must be treated as not having a unique ID." The unique ID
is used in the definition of the id() function in section 4.1 of XPath
1.0.
Thanks,
Henry
[1] http://www.w3.org/TR/xpath#unique-id
------------------------------------------------------------------
Henry Zongaro XSLT Processors Development
IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]