What kind of processor are you running your XSLT and at what version ?
If you're running Saxon, you could make use of the "Extension Functions".
Between the following:
saxon:evaluate()
saxon:expression()
saxon:eval()
You should be able to manipulate an incoming string appropriately to use as an XPath. For full documentation on these functions see the official site.
http://www.saxonica.com/documentatio...functions.html
Im' not as familiar with the other processors available and specific functions they may have, but their may be something similar.