how to write this XPath expression?

suppose i have the folloing XML:
<bookstore>
<book>
<title> AAA</title>
<author> bbb</author>
<price 40 </price>
</book>
</bookstore>

& i want "title" for example as a return element, at the same time it is the predicate element.. how to make this expression?
i tried:
//title[.='AAA']
& it didn't work?!
[426 byte] By [alaa22] at [2007-11-19 21:12:30]
# 1 Re: how to write this XPath expression?
you might want one of these.
//title[normalize-space(.)='AAA']
//title[contains(.)='AAA']
jkmyoung at 2007-11-10 3:27:03 >
# 2 Re: how to write this XPath expression?
thank u
i went with normalize-space:-)
alaa22 at 2007-11-10 3:28:03 >
# 3 Re: how to write this XPath expression?
suppose i have the folloing XML:
<bookstore>
<book>
<title> AAA</title>
<author> bbb</author>
<price 40 </price>
</book>
</bookstore>

& i want "title" for example as a return element, at the same time it is the predicate element.. how to make this expression?
i tried:
//title[.='AAA']
& it didn't work?!

Hi alaa22 - just an idea for you: one way to help with writing and testing XPath expressions is to use an xpath evaluator (http://www.stylusstudio.com/xpath_evaluator.html) - this way you can just load the xml instance, plug in the xpath query (using either xpath 1.0 or xpath 2.0) then you can view the results. There's also some tools for generating xpath expresssions (http://www.stylusstudio.com/xpath_generator.html) as well as an xpath editor (http://www.stylusstudio.com/xpath_editor.html). You can download (http://www.stylusstudio.com/xml_download.html) it from here. Hope that helps.

Sincerely,
Stylus Studio fan
http://www.stylusstudio.com
stylusstudio at 2007-11-10 3:29:07 >