W3C home > Mailing lists > Public > www-ql@w3.org > July to September 2004

RE: Are these two xpath expression equal?

From: Michael Kay <mhk@mhk.me.uk>
Date: Tue, 31 Aug 2004 12:45:48 +0100
To: "'Fianny Jiang'" <mfjiang@cse.cuhk.edu.hk>, <www-ql@w3.org>
Message-ID: <E1C2766-0004fe-N7@frink.w3.org>
They are different. Consider the document
 
<A>
  <B>
    <C/>
  </B>
  <B>
    <D/>
  </B>
</A>
 
The first expression will select the <D/> element, the second will not.
 
The first expression selects a D using the path A/B/D provided that the A
owns a B which owns a C.
 
The second expression selects a D using the path A/B/D provided that the B
owns a C.
 
Michael Kay


  _____  

From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf Of
Fianny Jiang
Sent: 03 September 2004 12:09
To: www-ql@w3.org
Subject: Are these two xpath expression equal?


Hi,
 
   I am puzzled whether the following two XPaht expressions will return the
same result.
  (1)  A[B/C]/B/D
  (2)  A/B[C]/D
 
  Or in other words, will (1) require that the matched pattern should have
two different B's?  That is C and D should have different B as their parent.

  Thanks alot. 
 
Regards,
Fianny 
   
Received on Tuesday, 31 August 2004 11:46:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:16 UTC