Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XPath query to return nodes based on a range within an attribute's value.

XPath query to return nodes based on a range within an attribute's value.

Scheduled Pinned Locked Moved XML / XSL
databasexmlhelptutorial
3 Posts 2 Posters 12 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bill Moo
    wrote on last edited by
    #1

    Hello All, I want to return a set of nodes where the value of my ID attribute falls within a specified range. i.e. if I have 200 elements with each elements' ID being sequential I would like to return N of them where the @ID >= X and @ID <= Y. But regardless of how I try to do this I end up with nothing! For example :

    /element[@ID >= '44' and following-sibling[@ID <= '50']

    Ideally this would return 6 elements but I get nothing, nor does :

    /input[@ID >= '44' and following-sibling[@ID <= '50']]

    I would appreciate your help on this please, it's driving me to distraction.

    -- Moo

    W 1 Reply Last reply
    0
    • B Bill Moo

      Hello All, I want to return a set of nodes where the value of my ID attribute falls within a specified range. i.e. if I have 200 elements with each elements' ID being sequential I would like to return N of them where the @ID >= X and @ID <= Y. But regardless of how I try to do this I end up with nothing! For example :

      /element[@ID >= '44' and following-sibling[@ID <= '50']

      Ideally this would return 6 elements but I get nothing, nor does :

      /input[@ID >= '44' and following-sibling[@ID <= '50']]

      I would appreciate your help on this please, it's driving me to distraction.

      -- Moo

      W Offline
      W Offline
      woopsydoozy
      wrote on last edited by
      #2

      you're over-thinking it:

      element[@ID >= '44' and @ID <= '50']

      B 1 Reply Last reply
      0
      • W woopsydoozy

        you're over-thinking it:

        element[@ID >= '44' and @ID <= '50']

        B Offline
        B Offline
        Bill Moo
        wrote on last edited by
        #3

        Of course! Thank you.

        -- Moo

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups