Subject: Re: RE: Setting Namespace on Generated xsl:stylesheet Element
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 26 Jan 2010 15:19:38 +0000
|
>> <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
>
> Thanks, Ken. This solution worked flawlessly for me.
>
> Stylistically, I prefer to use <xsl:element> to generate elements, but I
can
> definitely live with this solution.
Well, if you enjoy the pain, you can do this:
<xsl:template match="/">
<xsl:element name="xsl:stylesheet">
<xsl:namespace name="xs">http://www.w3.org/2001/XMLSchema</xsl:namespace>
<xsl:attribute name="version">2.0</xsl:attribute>
<xsl:attribute name="exclude-result-prefixes">xs</xsl:attribute>
<xsl:element name="xsl:template">
<xsl:attribute name="match">/</xsl:attribute>
<xsl:element name="xsl:value-of">
<xsl:attribute name="select">.</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
which creates this:
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
exclude-result-prefixes="xs">
<xsl:template match="/">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
|