xsl-list
[Top] [All Lists]

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

2010-01-27 05:00:56
Andrew Welch <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com> wrote:

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>

Ah, hurts so good :-)

Seriously, I already had a solution that used <xsl:namespace>.  I was
looking for a solution that would work in XSLT 1.0.  Ideally, the solution
would use <xsl:element> to generate elements instead of inserting them
literally, but Ken provided a solution that at least works in XSLT 1.0.

--
Roger L. Cauvin
@rcauvin (Twitter)
cauvin.blogspot.com (blog)



--~------------------------------------------------------------------
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>