|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
XPath Help
Hi, I'm trying to get some XPath to work with respect to a navigation tree.Tony Pimm 05/21/04 07:04 A I found this site to be an excellent eye opener for xPath.Ian Sheridan 05/21/04 07:58 A I shot that off to fast here is a more focused link. the site is aIan Sheridan 05/21/04 08:02 A At 07:04 AM 5/21/2004, you wrote:Alexander Sherwood 05/21/04 08:30 A Hi, I'm trying to get some XPath to work with respect to a navigation tree. <?xml version="1.0" encoding="utf-8" ?> <tree> <node objectid="3456" title="Informationa"> <node objectid="2134" title="Contact" /> <node objectid="5656" title="Top 1.2" /> <node objectid="5672" title="Top 1.3" /> <node objectid="123" title="Top 1.4" /> <node objectid="8357" title="Top 1.5" /> </node> <node objectid="9834" title="Banks" circuit="banks" /> <node objectid="2245" title="Corporates" circuit="corporates"> <node objectid="45688" title="Top 3.1" /> <node objectid="9567" title="Top 3.2" /> <node objectid="4633" title="Top 3.3" /> </node> <node objectid="1554" title="Managers" /> <node objectid="6734" title="Library" /> </tree> I can use Xpath to return all the child nodes within a node using //node[@objectid="3"] However, how can I do this in reverse? How can I retrieve the node that is the parent of a particular node? How can I get the objectid of the parent of 2134? Any help you could share would be great! Thanks Tony I found this site to be an excellent eye opener for xPath. http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan isheridan@savagevines.com http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I shot that off to fast here is a more focused link. the site is a little confusing. http://www.zvon.org/xxl/XPathTutorial/Output/example1.html On May 21, 2004, at 7:56 AM, Ian Sheridan wrote: > I found this site to be an excellent eye opener for xPath. > > http://www.zvon.org/xxl/XPathTutorial/General/examples.html Ian - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ian Sheridan isheridan@savagevines.com http://www.savagevines.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - At 07:04 AM 5/21/2004, you wrote: ----- Excess quoted text cut - see Original Post for more ----- Couple of things here, Tony. 1) You can "chain" xpaths together. 2) Learn all of the Xpaths Axes (sp?)! In this case, you could grab the objectID of the node element with an objectID of 2134 like this: //node[@objectid=2134]/parent::node Notice the reference to the exact node, and then a reference to the "parent" axis, asking for a "node" element. Hope this helps. ---------------------------------- Alex Sherwood PHS Collection Agency THE COLLECTORS P: 813-283-4579 F: 301.664.6834 W: www.phs-net.com
|
May 25, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||