Yes, you can generate XSLT using XSLT. There's a special feature you can use to get round your problem called xsl:namespace-alias. You'll find information about it, and an example, here:
http://www.w3.org/TR/xslt20/#element-namespace-alias
This is XSLT 2.0 but it hasn't changed very much since 1.0.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference