W3C home > Mailing lists > Public > www-xpath-comments@w3.org > October to December 2002

RE: semantic meaning of predicates

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 5 Nov 2002 16:43:21 +0100
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DD47@daemsg02.software-ag.de>
To: "'Tianzhi Yang'" <tyang@firstrain.com>, www-xpath-comments@w3.org

> Hi, I got one question regarding the semantic meaning of predicates.
> For example, in message:
> <a>
> 	<b>
> 		<id>1</id>
> 		<id>2</id>
> 	</b>
> 	<b>
> 		<id>3</id>
> 		<id>4</id>
> 	</b>
> </a>
> 1. Is there a difference between (a)./a[b/id='1' and 
> b/id='2'] and (b)/a[b[id='1' and id='2']

Yes, there is a difference (though with this data, both give the same

(a) means "select the <a> element if it has a <b> with an <id> of 1 and if
it also has a <b> with an <id> of 2".

(b) means "select the <a> element if it has a <b> that has both an <id> of 1
and an <id> of 2".

In other words, (a) will select the <a> element if the id="1" and id="2" are
on different <b> children, while (b) requires them to be on the same child.

Michael Kay
Received on Tuesday, 5 November 2002 10:43:35 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:02:15 UTC