[xsl] Seeking combinatorial XPATH

Subject: [xsl] Seeking combinatorial XPATH
From: "Paul Bell" <pbell@xxxxxxxxxxxx>
Date: Tue, 6 Mar 2001 14:14:52 -0500
Hi All,

I finally did get this to work.  To wit, given XML DOM ( see below ), the
XPATH expression:

A[B[@NM = "case1"][text() = //A[B[@NM = "case3"]/text()]]]

returned the first two 'A' nodes because value of A/B[@NM="case1"] equals
A/B[@NM="case3'] - each is 'abc'.

Note that this next expression, without the descendants operator before the
'A' returned nothing:

A[B[@NM = "case1"][text() = A[B[@NM = "case3"]/text()]]]

My goal here is to let XPATH do some combinatorial work for me, where, I
suppose, it will be faster than if done in script or java.

Interpreting in english the expression that works, I come up with something
like this:

'return A nodes with a B child the value of whose 'case1' NM attribute is
equal to any A node with a B child's 'case3' NM attribute'.  (Arrggh...).

Strange to say, if I change the expression by switching just the attribute
names as follows:

A[B[@NM = "case3"][text() = //A[B[@NM = "case1"]/text()]]]

then the expression no longer works - it returns nothing.....

Can anyone explain this seeming anomaly?

BTW: I am using MSXML3.0 and have most righteously set the XML data island's
'SelectionLanguage' property to 'XPath'.  That is, we're not using 'xsl

I am also getting headache.  Thanks for your help.




<A ID="match1">
  <B NM="case1">abc</B>
  <B NM="case2">xyz</B>

<A ID="match2">
  <B NM="case3">abc</B>
  <B NM="case4">def</B>

  <B NM="case5">lmn</B>
  <B NM="case6">qrs</B>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread