> -----Original Message----- > From: Wilfred Tam [mailto:[EMAIL PROTECTED] > Sent: donderdag 7 maart 2002 8:18 > To: [email protected] > Subject: XPath newbie question > > > Hi all, > > I have a collection (/db/c1/test4) which contains the > following xml file: > [...]
> > Using the following xpath I can get back this xml : > xindice xpath -c /db/c1/test4 -q > '/test4[contains(//addressline,"A1")]' > (match for the first <addressline> tag) this DOESN'T match the addressline 'tag', but the test4 element as a whole remember an XPath expression is composed of location steps, each consisting of - an axis - a node test - a predicate It is my belief that one should read up on this subject before using the shorthand notation > But the following doesn't work : > xindice xpath -c /db/c1/test4 -q > '/test4[contains(//addressline,"due")]' > (match for the last <addressline> tag) > > Could anybody tell me what's wrong? Sorry if this is a stupid > question... > Thanks! Depends on what you want to select: This XPath instruction /test4/abc/*[descendant::addressline[contains(.,'due')]] will select all elements (i.e. row1's or row2's) that contain a descendant element addressline which contains a string due. Perhaps you would also like to change your XML document structure: row1/row2/row3 seems like an ideal case for a <row number="x"> element HTH, not meaning to be impolite, </Steven>
