I’ve been using XSL for a long time, and I know I’ve used XSL in the past to generate XSL, but today I found a very handy technique for doing so: namespace aliases!

Here’s the articles I found which explain how its done:

http://www.xml.com/pub/a/2001/04/04/trxml/index.html

http://www.xml.com/pub/a/2003/11/05/xslt.html

In a nutshell, this is it:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
>
<xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
<xsl:template match="/">
<xslo:stylesheet version="1.0">
<xslo:template match="/">
<xslo:value-of select="//name"/>
</xslo:template>
</xslo:stylesheet>
</xsl:template>
</xsl:stylesheet>