Matching values in XPATH

  • Thread starter Thread starter Jesper Denmark
  • Start date Start date
J

Jesper Denmark

I use Xpath to retrieve nodes in a document like :

doc.SelectSingleNode("/properties/layer[@width='0.2']");

- however this is not very robust as I'm only query on
text. What if width='0.200' instead of width='0.2', then
the above Xpath line wont match the node in question. Is
there a way to query for the value instead of the text?

Best regards
Jesper.
 
Please post xml related questions to microsoft.public.dotnet.xml, I'm sure
you will find better help there.
Willy.
 
Jesper,
Is there a way to query for the value instead of the text?

Try

doc.SelectSingleNode("/properties/layer[number(@width)=0.2]");



Mattias
 

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

Back
Top