Maybe let me provide some elements for you to develop in order to achieve the requested functionality of incorporating what we may call dynamic xpath.
The main thing to note is that within the xmlquery(), the part of script between '...' can actually be a full xquery "program" proper. It can be much more elaborated than a simple use of a couple of line pertaining to xquery update facility, And xquery itself has a lot of functionality that can be used to facilitate the construction of dynamic xpath from xs:string. Whether there exists a simple built-in xpath function can do it, I doubt it. But there are quite a bit of user-defined functions, amid usually written with clearly stated limitation, exist out there. And you can take advantage using them.
A wealth of user defined functions is collected in the functx site. And in particular what comes to my mind is the functx:dynamic-path() which itself depends on three helper functions that you need to add to the script.
It comes with some sever restrictions : but with your need of having ns:Test1/Test2 part, it is within its applicable range for dynamically constructed xpath.
Take a look of it and incorporating it to the xmlquery() will do it nicely though on its look may seem laborious for some. But the main thing is it gets the job done. If you find some difficulty incorporating it, return by describing what advance you've made and may be I can help you further if necessary. If you think that is just a kind of sweetener and that you prefer to let it go, then don't worry about it.