With Tamino 4.2 you don’t need to rewrite the query in the way it is suggested by the documentation to get proper performance. This means you can write your single variable query like this:
(
for $a in input()/contract sort by (zip)
where$/zip > 2134
return {($a/name, $a/…}
)
[position() > 1100 and position() >1150]
The result of an XQuery expression is an instance of the XQuery data model. This does not contain any kind of tuples. Therefore you have to return a “result” element that contains the binding of both variables. An according query may look like this:
(
for $a in input()/contract sort by (zip), $b in input()/party
where $a/zip > 2134
…some conditions on $b…