|
[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
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
|
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
|

Cart








