beginner question: feeding a query string into an Xpath expression

Discussion in 'ASP .Net' started by xerj, May 8, 2006.

  1. xerj

    xerj Guest

    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.
     
    xerj, May 8, 2006
    #1
    1. Advertising

  2. 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.

    xerj wrote:
    > 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.
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, May 8, 2006
    #2
    1. Advertising

  3. xerj

    xerj Guest

    >>> I think that you are making it far more complicated than it is

    I sure was.

    Thanks a plenty! Works now.
     
    xerj, May 8, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GIMME
    Replies:
    3
    Views:
    12,049
    vforvikash
    Dec 29, 2008
  2. David Gordon

    xpath query query

    David Gordon, May 18, 2005, in forum: XML
    Replies:
    2
    Views:
    831
    David Gordon
    May 18, 2005
  3. John Nagle
    Replies:
    2
    Views:
    502
    Dennis Lee Bieber
    Nov 15, 2007
  4. lxmxn
    Replies:
    2
    Views:
    378
    ggrothendieck
    May 3, 2008
  5. Replies:
    12
    Views:
    1,002
    Jerry Coffin
    Jun 2, 2008
Loading...

Share This Page