Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Get Max Attribute Value

Hybrid View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

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

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Question Re: [2005] Get Max Attribute Value

    Bump up ...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    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.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600

    Unhappy 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
  •  



Click Here to Expand Forum to Full Width