One query, many languages
Every language lowers to the same algebra, so a LANG block is not an opaque call to another engine. It becomes part of one plan the optimizer reasons about as a whole, letting you express each part of a cross-model query in the language that fits it best. Here SQL filters users by a count computed with XQuery over an XML document.
SELECT name, age
FROM users
WHERE age > 30 AND (
LANG xquery
fn:count($invoices/customer[. = $users:name])
) > 5
