0

Hi,

I wonder if anyone on this list has tried to mix numerical variable, such as 1, 2,3 within an xpath expression.

songList = document.SelectNodes("/music_songs/song[category='" & drop1.SelectedItem.Text & "'][item_number_first<=position()<=item_number_last]")

For some reason, item_number_first and item_number_last appear to have no value in the above code snippet, when they do have values they get printed as in the following:

mess.Text += "Items for page " & page_no & " is: " & item_number_first & " to " & item_number_last & "<br />"

Could anyone please give me some hints on what to modify here to make the numerical data be able to mix within my xpath? Thanks for your help.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ajwei810192
0

I think you have a tiny logical error. Shouldn't your code be

songList = document.SelectNodes("/music_songs/song[category='" & drop1.SelectedItem.Text & "'][" & item_number_first & "<=position()<=" & item_number_last & "]")

now if item_number_first were 1 and item_number_last were 10, the expression would evaluate to a string: ...SelectNodes("...[1<=position()<=10]") HTH

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.