I am trying to dynamically generate an XSLT document from an XSLT stylesheet. In principle this works, of course, but I do not get the namespaces working. I want to have the generated XSLT elements to be prefixed with "xsl" prefix:
<xsl:stylesheet ...>
rather than
<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform">
I played around with namespace="" of xsl:element and with xsl:namespace but I do not get it working (xslt2/saxon available)
Any hints?
I found the solution:
does the job! (i.e., avoid using namespace="" but explicitely list the namespace prefix)
The
xsl:namespace-alias
instruction was designed having exactly this use case in mind -- just start using it in your work.Here is a real-world example:
http://dnovatchev.wordpress.com/2006/10/21/a-stylesheet-to-write-xslt-code/
If you want to use XSLT to create XSLT code then using http://www.w3.org/TR/xslt20/#element-namespace-alias helps e.g.