xsl-list
[Top] [All Lists]

Re: [xsl] RE: Setting Namespace on Generated xsl:stylesheet Element

2010-01-26 09:20:11
<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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>