Docunext


XSL Namespace Aliases

December 7th, 2009

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>
Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022