[Home] [By Thread] [By Date] [Recent Entries]

  • To: "Joe English" <jenglish@f...>,<xml-dev@l...>
  • Subject: RE: Xpath Question
  • From: "Michael Rys" <mrys@m...>
  • Date: Fri, 25 Jul 2003 11:33:56 -0700
  • Thread-index: AcNS18DXHEfhXyrgSP2mATQA2WFuEQAAdddQ
  • Thread-topic: Xpath Question

It is either 2 or 5 depending on whether your parser preserved the text
nodes containing boundary whitespace.

And yes, the child::* expression would be cleaner if only element nodes
are requested.

Best regards
Michael

> -----Original Message-----
> From: Joe English [mailto:jenglish@f...]
> Sent: Friday, July 25, 2003 11:06 AM
> To: xml-dev@l...
> Subject: Re:  Xpath Question
> 
> 
> Dare Obasanjo wrote:
> 
> > One of our devs just made me question all that's right in the world
with
> > the question below. Given the following XML
> >
> > <pre>
> >   <b>bold</b>
> >   <i>italic</i>
> > </pre>
> >
> > what is the result of the following XPath expression
> > "count(/pre/child::node())" ?
> >
> > Is the answer 2 or 5?
> 
> Five.
> 
> "count(/pre/child::*)" yields the more intuitively correct result.
> 
> 
> --Joe English
> 
>   jenglish@f...
> 
> 
> -----------------------------------------------------------------
> 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://lists.xml.org/ob/adm.pl>


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member