how to xpath if query string has embedded quotes

D

dima

I'm using msxml3

xml looks like this: <a desc="&quot;B&quot;" />

how to query it in xpath? here's what i tried:
a[@desc="\"B\""] -- This works under XSL Patterns, but not under Xpath
(using msxml 3)

a[@desc=' "B" '] --this will work, but what if description has single
quotes too? -then it won't work.

in short, i'm stuck. can anybody help?

thanks.
dmitry.
 
M

Martin Honnen

dima said:
I'm using msxml3

xml looks like this: <a desc="&quot;B&quot;" />

how to query it in xpath? here's what i tried:
a[@desc="\"B\""] -- This works under XSL Patterns, but not under Xpath
(using msxml 3)

a[@desc=' "B" '] --this will work, but what if description has single
quotes too? -then it won't work.

Use it as long as you don't have quotes of the same type nested.
Otherwise with XPath 1.0 all you can do is to use the concat function
the whole string from pieces with the quotes you need.
I don't know whether XPath 2.0 makes that any easier.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top