Tamino: Select parts of a XML document with XQuery


My problem is to select parts of a XML document in Tamino with XQuery.

My xml document is:

Now i want to get all rows with child elements where the number of available seats is bigger than a defined value.

My XQuery should look similar to that:
let $freeseats := 5
for $b in input()/performance
where $b/seats/@freeseats > $freeseats
and count($b/seats/row/@freeseats > $freeseats)
return $b/row

There are two problems with the query:
1. Function count() is not recognized by Tamino:
<ino:messagetext ino:code=“INOXQE6351”>XQuery feature not implemented</ino:messagetext>

Tried to use
declare namespace xf = "W3C XQuery 1.0 and XPath 2.0 Functions and Operators"
and xf:count, but without success.

2. The where clause i only true for parts of the document. (row id=“1”) For row id=“2” the where clause is false. Tried to use nested counts: count(count(…) > $freeseats) > 0 .
Got same problem as in (1.). Another problem is to return only the rows, where the clause is true.

Has anyone an idea, which XQuery could satisfy my needs?

Thanks in advance!

Hi Christian & others,

you also posted this question to another forum, i.e.
Native XML Store & X-Query, and it has been answered