W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Re: DOM L3 XPath: Multiple matching nodes when number, string or boolean type

From: Elliotte Rusty Harold <elharo@metalab.unc.edu>
Date: Sat, 16 Feb 2002 20:09:01 -0500
Message-Id: <p04330102b894b2752866@[]>
To: "Curt Arnold" <carnold@houston.rr.com>, <www-dom@w3.org>
At 6:34 PM -0600 2/16/02, Curt Arnold wrote:
Related to the recent singleNodeValue thread, I'm not sure if the 
case of multiple matching nodes has been adequately addressed for 
non-node return types.  For example, asking the 
query /svg/rect/@width with a number return type on the following 

<svg><rect width="100"/><rect width="200"/><svg>

This isn't a problem. Like all location paths, /svg/rect/@width 
returns a node-set, not a number.

number(/svg/rect/@width) returns a single number equal to 100; that 
is it converts only the first node in the set.

I don't think there's anything in standard XPath 1.0 that returns 
more than one number, boolean, or string.

| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
Received on Saturday, 16 February 2002 20:12:03 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC