|
-
Jan 27th, 2007, 07:32 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Get Max Attribute Value
Hi ....
This seems like it should be soooooo simple and obvious, but alas, I haven't been able to figure it out or find an answer on the web. I want to use an XPath expression to get the maximum attribute value from a set of nodes. For example, take this XML Document:
<MyList>
<Lists>
<Fruit FID="1" Title="one">
<FruitItem FIID="1" Text="apple" Sequence="1" />
</Fruit>
<Fruit FID="2" Title="two">
<FruitItem FIID="1" Text="pear" Sequence="1" />
<FruitItem FIID="2" Text="mango" Sequence="2" />
<FruitItem FIID="3" Text="grapes" Sequence="3" />
<FruitItem FIID="4" Text="pineapple" Sequence="4" />
<FruitItem FIID="5" Text="orange" Sequence="5" />
</Fruit>
<Lists>
</MyList>
I want to get the MAX Sequence attribute from the second Fruit node. I've been trying
Code:
Dim xn As XmlNode = xDoc.SelectSingleNode("max(//Fruit[@FID=2]/FruitItem/@Sequence)")
This works in XMLSpy, but I can't get it to work in VB.Net. Is there anyway to get the Max Sequence value in one statement? Or will I have to loop over the nodes to get it?
Thanks!
-
Jan 31st, 2007, 10:36 AM
#2
Thread Starter
Fanatic Member
Re: [2005] Get Max Attribute Value
-
Feb 1st, 2007, 01:23 PM
#3
Thread Starter
Fanatic Member
Re: [2005] Get Max Attribute Value
My last try to get a response. If no one replies this time, I'll assume it can't be done and mark the thread as *resolved*.
Thanks.
-
Feb 3rd, 2007, 03:41 PM
#4
Thread Starter
Fanatic Member
Re: [2005] Get Max Attribute Value
I'm assuming that this is impossible. :-(
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|