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.

Recommended Answers

All 2 Replies

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 is what I needed, thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.