0

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]")

1 Answer 1

3

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']"
Sign up to request clarification or add additional context in comments.

1 Comment

Last one worked. First one doesn't apply because as I said I derive $key value from external source without single quote.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.