where clause with variables ??

hi all,
i’ll show you my problem!

it’s possible to replace something like this:


for $a in doc( '/db/tesi/UtentiIstanza.xml' )/utenti/utente
where $a/credenziali/unacredenziale[nomecredenziale='CI']/residenza='Milano'
return $a/id

with something like this:


let $expcred := "credenziali/unacredenziale[nomecredenziale='CI']/residenza='Milano'"
for $a in doc( '/db/tesi/UtentiIstanza.xml' )/utenti/utente
where $a/$expcred
return $a/id

the first example works,the second no,how can i do?
i’ve tryied many other solutions but it never works :cry:
I need to use this in a function and $expcred is one of my parameters

thanks a lot for your help
Matthew


this is my XML

0 admin admin 1 teyo qwerty CI O'Brien Matthew Milano studente BIB O'Brien Matthew MI12345

Hi,

this is the Tamino foru, Please understand, that non-Tamino related questions (like yours) might not be answered

Regards

Harald

It looks like you’re looking for some kind of macro functionality, or an “eval” function, or some such. No, XQuery doesn’t provide that.