In an other thread I read that someone get it to work (to use the emty()-function), but I can’t do it…
I get an error (function unknown: empty.)
I want to use a where clause like this:
Isn’t it possible, or do I something wrong?
no, Tamino in version 4.1 does not support the empty() function
use count() = 0 instead. Still your where clause seems strange
to me, maybe I’d understand if I saw the complete query.
An example that works for me is
for $b in input()//book
where count($b/author) = 0
in collection bookshop.
here is the complete query (with the use pf the emtpy function). Maybe you can find out, if it’s strange, and why ! Perhaps there is something to optimize…
The query’s aim is to get the last 100 modified documents (latest update_time attributes of the directory document) for all documents wich have an author attribute…
for $r in
for $d in input()/directory//doc_info[@update_time]
sort by (@update_time descending)
[position() > 0 and position() < 15]
[here is the original query for X-hive, that I want to adapt to Tamino:
let $b :=
(for $a in document("/directory.xml")/directory//doc_info[@update_time] sortby (./@update_time descending)
sublist($b, 1, 100)
THANKS in advance…
the original X-Hive query uses the document function to read
the directory and the docs info from two different XML files.
In Tamino you obviously represent the directory info by the
doctype ‘directory’. Where is the ‘docs’ info ?
I presume it is represented by a ‘docs’ doctype ?
Anyway, you can drop the first and the last two lines from
your query, just surround your FLWR in brackets and apply
The where clause selects those documents which are
mentioned in ‘docs’ and the respective element contains
an author attribute. Thus the where clause reads as
where count (input()/docs/*[@doc_id = $d/@doc_id]/@author) > 0