This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Seeking combinatorial XPATH
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Seeking combinatorial XPATH
- From: "Paul Bell" <pbell at syncsort dot com>
- Date: Tue, 6 Mar 2001 14:14:52 -0500
- Organization: Syncsort Incorporated
- Reply-To: xsl-list at lists dot mulberrytech dot com
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
patterns'.
I am also getting headache. Thanks for your help.
Cordially,
Paul
<ROOT>
<A ID="match1">
<B NM="case1">abc</B>
<B NM="case2">xyz</B>
---
</A>
<A ID="match2">
<B NM="case3">abc</B>
<B NM="case4">def</B>
----
</A>
<A>
<B NM="case5">lmn</B>
<B NM="case6">qrs</B>
----
</A>
</ROOT>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list