beginner question: feeding a query string into an Xpath expression

  • Thread starter Thread starter xerj
  • Start date Start date
X

xerj

I've worked out how to retrieve a parameter from a query string in a url
using Request.Querystring("whatever"). However, what I can't figure out is
how to feed this into an Xpath expression.

For instance, say I have an Xpath as follows:
food/fruit[@type='typeoffruit']. How do I programmatically alter the
'typeoffruit' attribute using the querystring in the url (example
whatever.aspx?fruit=banana via Request.Querystring or whatever command is
needed to achieved this? Via code render blocks?

TIA.
 
I think that you are making it far more complicated than it is... Just
concatenate the strings:

"food/fruit[@type='" + Request.QueryString("fruit") + "']"

When you got it working you should validate the input first, though.
 
I think that you are making it far more complicated than it is

I sure was.

Thanks a plenty! Works now.
 
Back
Top