in reply to xpath invalid expression

Did you test it enclosing $t with '?
Regards