473,569 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get first grandparent attribute not nodeset?

K B
Hi,

I'm using this...

//Role[@UserName='kbur ke'][not(@finish)]/../../@Name

but it returns more than one result. I need the FIRST grandparent @Name
returned. I've tried:

//Role[@UserName='kbur ke'][not(@finish)]/../../item[1]/@Name and
variations of last() but haven't gotten it yet.

Thanks,
Kit

*** Sent via Developersdex http://www.developersdex.com ***
May 24 '06 #1
1 1192


K B wrote:

I'm using this...

//Role[@UserName='kbur ke'][not(@finish)]/../../@Name

but it returns more than one result. I need the FIRST grandparent @Name
returned.


Consider showing the relevant input XML structure that is is easier to
give you a proper XPath expression.
If you want only one node you can always do e.g.
expression[1]
in the above case
(//Role[@UserName='kbur ke'][not(@finish)]/../../@Name)[1]
Other variations that might give you what you want are
//Role[@UserName='kbur ke'][not(@finish)][1]/../../@Name

If those suggestions don't help then show us the XML input.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2627
by: darrel | last post by:
Is there a way in XSLT to write this XSL:Value-of select statement (which I've written in plain english): value of the attribute of the first ascendent to have a value. In otherwords, I have an element, and I want to get the parent attribute that contains an actual value up the chain. This might be the immediate parent's attribute, the...
0
316
by: darrel | last post by:
Is there a way in XSLT to write this XSL:Value-of select statement (which I've written in plain english): value of the attribute of the first ascendent to have a value. In otherwords, I have an element, and I want to get the parent attribute that contains an actual value up the chain. This might be the immediate parent's attribute, the...
1
4419
by: soupaman | last post by:
Im trying to output some filtered xml using the xmlTextReader I know the code and commenting needs cleaned up and eventually plan to add the values to a dataset. currently what this is doing is matching the filters, runs into the response.write and outputs nothing. I've used the dbgclr to verify that the filters are matching and it is hitting...
2
1455
by: Tjerk Wolterink | last post by:
I have xml like this: <data> <binding nodeset="/data/set1/value"/> <set1> <value name="a" value="3"/> </set1> </data>
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.