[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Xpath problem
Hello Kan, from a ancestor of the desired "value" attribute whose content is '2111': //*[@value='2111'] or from anywhere: /*//*[@value='2111'] But, be advised that these will bring back all elements (any element) that has an attribute named "value" and whose value is '2111'. If you expected the possiblity of many elements returned, but only care about the first then you append another predicate to the end of the first one to return the first node: //*[@value='2111'][1] or from anywhere: /*//*[@value='2111'][1] But since you are using "selectSingleNode" you wouldn't have to worry about this, it'll always just return the first node from the list of elements found. You may want to look up some information on XPath "Predicates" and how they work. -Jeff -----Original Message----- From: Kanthi Damodaran [mailto:kdsm17@xxxxxxxxxxx] Sent: Monday, March 04, 2002 3:30 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Xpath problem Hi - This might seems like a really silly question, dur to my unfamiliarity with XPath syntax and functions. Here is the problem. I want to specify a path to a specific value in my XML Dom ie Path = "//value='2111' and I did this by using the selectSingleNode method of the DOM. But the problem is that it also picks up following values '21112', 21113' etc. How do I specify that I want the node ONLY if it is '2111'? Thanks in advance for the help. Kan _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|