How can I use element or node variabele in my xquery string in  Java ?
The reason why is to build my query string dynamically. I know how to use string or integer variables. But voor element selection is have to use another i guess. So I want to replace "$element" by de tag element. If i use string variable it wont work ?

xquerystring code :

+ "declare variable $xmlDoc2 as node() external; "
            + "declare variable $getal as xs:integer external;"
            + "declare variable $matchingElement1 as element() external;"
            + "for $r1 in $xmlDoc1/ROOT/RECORD, "
            + "$r2 in $xmlDoc2/ROOT/RECORD "
            + "where $r2/$element = $r1/Number and $r2/Age > $getal"
            + " return "
            + "<ROOT><RECORD>{$r1/*, $r2/(* except ID)}</RECORD></ROOT>";

binding code:
XQExpression xqExpr = conn.createExpression();
            xqExpr.bindItem(new QName("xmlDoc1"), xqItem1);
            xqExpr.bindItem(new QName("xmlDoc2"), xqItem2);

Does somebody know ?