Hua -- Thanks, but that's not quite right. I agree that getting the sponsorship element is easy with the expression you provided, but what I actually need is the parent identity element (along with all of its sponsorship subelements) of any sponsorship elements with a status attribute of Active and a text value of Provost.
-- LBA Hua Wei wrote: > Larry, > Not sure whether this is what you are looking for: > > /IDMS/identity/[EMAIL PROTECTED]'Active' and text()='Provost'] > > Returns this element: > <sponsorship status="Active" start_date="May 9 2003">Provost</sponsorship> > > Hua > > -----Original Message----- > From: Lawrence B. Afrin, M.D. [mailto:[EMAIL PROTECTED] > Sent: Friday, December 16, 2005 11:25 AM > To: CF-Talk > Subject: Need help with tricky XPath syntax > > Howdy -- > > I'm having difficulty crafting a tricky XPath expression and would appreciate > help from any XPath gurus out there. > > Sample document: > > <IDMS> > <identity idms_id="900000282"> > <sponsorship status="Inactive" start_date="Jul 20 > 2004">Provost</sponsorship> > <sponsorship status="Active" start_date="May 28 2004 > ">Residents</sponsorship> > </identity> > <identity idms_id="900018891"> > <sponsorship status="Active" start_date="May 6 2003">HR</sponsorship> > <sponsorship status="Active" start_date="May 9 2003">Provost</sponsorship> > <sponsorship status="Active" start_date="May 8 2003">UMA</sponsorship> > </identity> > </IDMS> > > I need an XPath expression that will extract the array of <identity> elements > with Active Provost sponsorship. > > Applying the expression I seek against the above document would yield a > one-element array containing only the second <identity> element from the > document. > > Extracting the <identity> elements with Provost sponsorship is trivial: > > /IDMS/identity[sponsorship='Provost'] > > The tricky part seems to be restricting the selection to only the *Active* > Provost sponsorships. > > I've tried a zillion permutations on the following as the second argument to > my XMLSearch() call, but none of my experiments has worked right yet: > > /IDMS/identity[sponsorship='Provost' and [EMAIL PROTECTED]'Active']] > > I've looked through all the XPath tutorials I could find but couldn't find an > answer to this question (at least, not an answer I could understand). > Looking at some complex examples I've found in some tutorials, I've gotten a > vague sense that somehow "id()" and "self::" are going to be involved in a > solution, but otherwise I'm just totally lost. > > Greatly appreciate any help anyone can provide. > > -- Larry Afrin > Medical University of South Carolina > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:227190 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

