XPath Node Set Functions

Does any know if node set functions, such as count or position, are vaild to use in the HDi world I've been trying, but I keep having problems getting a valued returned. Below is the line that is giving me the issue. It may not be 100% correct because I am writing this from home without the exact code in front of me. I believe it's close enough to get the idea across though.

var position = this.savedbookmarks.evaluteXPath(position(//bookmark[@time="+current+")],this.savedbookmarks.documentElement);

From what I can remember, the evaluteXPath call returns a node list. In this case, it's returning a node list with a length of zero. Is there maybe a different way I should be going about this



Answer this question

XPath Node Set Functions

  • Attila Fogel

    That xpath call is correct.  If its returning a nodelist of length zero, that means you do not have a node called bookmark with a time attribute that matches current.  Look at your format of current and the node you are trying to match - that's probably where you issue is.

    There is something eerily familiar about that line...



  • Saji

    Current is a string value of the time without the colons. I'm sorry I haven't had time to work on this lately, so I don't have any feedback just yet. Another project took priority of this one.
  • bookysmell2004

    Hi there

    Re-Writing
    position(//bookmark[@time="+current+")]
    as

    "position(//bookmark[@time='+current+'])


    What is
    +current+








  • The Kelvinater127

    The current variable is being concatenated with the string. The formatting of the code was probably messed up when typing into the forum (when it sees two forward slashes, it tends to mess things up).

  • XPath Node Set Functions