[xquery-talk] filter function

David Carlisle davidc at nag.co.uk
Fri Jun 30 10:57:09 PDT 2006

  i mean this piece of code does not return paths from
  the file oredr.xml which satisfy my condition
  it returns

what do you expect it to do?
I assume that it doesn't really return what you show, filter() but
filter ($d,$d//order[vcd|book]/text())

It is just the literal text content of the direct element constructor so
is copied as text to the output. If you want it to be evaluated as an
XQuery expression then (as always) it needs to be inside {...} But then
you would just get an error message saying that filter() is an unknown
function (as XQuery does not have a function of that name).
let $d:=doc("order.xml")
{filter ($d,$d//order[vcd|book]/text())}

$ saxon8q f.xq
Error on line 4 column 40 of file:/c:/tmp/f.xq:
  XPST0017: XQuery static error in #...d,$d//order[vcd|book]/text())}#:
    Unknown system function filter()
Failed to compile query


More information about the talk mailing list