Reputation: 4048
In the expression below I would like $key variable to be expanded to
"//configuration[@navtitle='Some Report']"
How do I achieve that? know that $key value is derived from external file
$key = "Some Report"
Xml.SelectNodes("//configuration[@title=$key]")
Upvotes: 0
Views: 307
Reputation: 29480
Single quotes won't be parsed within double quotes. You could put the single quotes in $key or the string:
$key = "'Some Report'"
"//configuration[@title=$key]"
Output:
//configuration[@title='Some Report']
OR
$key = "Some Report"
"//configuration[@title='$key']"
Upvotes: 3