[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPath needed for getting the nearest attribute on the

Subject: XPath needed for getting the nearest attribute on the ancestor axis till aNode with a particular name() is found
From: "Sanjay Pandey/Towers Perrin" <pandeys@xxxxxxxxxx>
Date: Wed, 22 Aug 2001 09:29:55 -0400
xsl ifnot
Hi list,

I needed to get the nearest attribute value (with name() 'name' or 'type'
or 'category') on the ancestor axis, starting from a particular node. I am
able to do that, thanks to this list too for that, using the following:
            xpathStr = "./ancestor::*[@name or @type or
@category][1]/@*[name() = 'name' or name() = 'type' or name()
= 'category']";
            XObject obj = XPathAPI.eval(currentNode,xpathStr);
It works fine. Now I want to limit the ancestor axis traversal till I find
a node with name() = 'someName', otherwise the search would continue till
root node.

Can this be done within the single XPath or I will need to do a loop where
I go one node up check if I have hit the node with 'someName', ifNot then
look for the relevant attribute?

Suggestions would be appreciated.

Thanks,
Sanjay



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.