[xquery-talk] xpath1 text node contains attribute, equivalent in xpath2
Liam R E Quin
liam at w3.org
Fri Dec 27 01:30:03 PST 2013
On Fri, 2013-12-27 at 09:20 +0000, e-letter wrote:
> Xpath1 specification § 4.2 string functions
> (http://www.w3.org/TR/xpath/#section-String-Functions) describes a
> "contains" function, but this was not found in xpath2;
Better to use the XPath 2 Functions and Operators spec, which does
indeed list fn:contains().
In XQuery you might need to call it fn:contains() rather than
contains(), depending on options.
> Is it possible to remove the xml elements from the output file?
Change return $x to return $x/text() maybe
> An alternative xquery was attempted:
>
> ...<p>
> {
> let $x := fn:doc("xmldatabasefile.xml")/bookstore/book/title/text()
> return $x
> }
> </p>...
> Is it possible to select a specific title text with this xquery syntax?
Yes. E.g. ......bookstore/book/title[fn:contains(., 'Learning XML')]
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
More information about the talk
mailing list