|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Count a specific word in a documentBas de Bakker bas at x-hive.comThu Jun 14 09:53:40 PDT 2007
Michael Kay wrote: > In fact the use of /text() is very common in XQuery circles, and in my view > it's usually wrong. You nearly always want the string value of the element > rather than its text node children: /string() rather than /text(), except as > I say that it's usually implicit. Indeed, which allows me to return to one of my pet peeves: bad examples in the XQuery Use Cases document, which many people use as examples. In this case, we read: 1.1.9.9 Q9 In the document "books.xml", find all section or chapter titles that contain the word "XML", regardless of the level of nesting. Solution in XQuery: <results> { for $t in doc("books.xml")//(chapter | section)/title where contains($t/text(), "XML") return $t } </results> Regards, Bas de Bakker
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






