Re: Re: Xpath arguments in variable
| From: | Sridhar Pandurangiah | Date: | Wed, 15 Sep 2010 08:57:39 +0000 |
| Subject: | Re: Re: Xpath arguments in variable | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308095@lists.php.net to get a copy of this message | ||
Managed to resolve it. Phew!
$v = $row->xpath('//membernumber[. = ' . '"' . $MemberId . '"' . ']');
works.
Best regards
Sridhar
-------- Original Message --------
Subject: Re: [PHP] Re: Xpath arguments in variable
From: ash@ashleysheridan.co.uk (Ashley Sheridan)
To:
Date: Wed Sep 15 2010 14:04:33 GMT+0530 (IST)
On Wed, 2010-09-15 at 14:03 +0530, Sridhar Pandurangiah wrote:-------- Original Message -------- Subject: Re: Xpath arguments in variable From: php-general@garydjones.name (Gary) To: Date: Wed Sep 15 2010 13:34:11 GMT+0530 (IST) Whats wrong with $v = $row->xpath('//membernumber[. = ' . $MemberId . ']'); ? Am I not understanding what you are trying to ask? -------------------- I tried this but doesn't work. I guess the above statement is concatenating the entire string and the substitution isn't happening What I am trying to do is as follows $MemberId = 'A192'; $v = $row->xpath('//membernumber[. = ' . $MemberId . ']'); The $MemberId should be substituted with A192 and then the xpath query should be executed. The result should be that I locate the membernumber XML element that has the value A912. Best regards SridharDid you try using double quotes? Thanks, Ash http://www.ashleysheridan.co.ukSridhar Pandurangiah wrote:now I need to pass this value to XPath within a string variable say $v = $row->xpath('//membernumber[. = $MemberId]'); But this doesnt work due to the quotes. What I intend PHP to do is to substitute the value for $MemberId and then execute the XPath query. I have grappled with it for a few days before posting this.Whats wrong with $v = $row->xpath('//membernumber[. = ' . $MemberId . ']'); ? Am I not understanding what you are trying to ask?