xsl-list
[Top] [All Lists]

[xsl] Setting Namespace on Generated xsl:stylesheet Element

2010-01-25 10:12:37
I'm using a stylesheet (A.xsl) to generate another stylesheet (B.xsl).
B.xsl will process Atom feeds and thus needs to reference the atom
namespace.  Consequently, B.xsl needs a namespace declaration in the
xsl:stylesheet element:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                              xmlns:atom="http://www.w3.org/2005/Atom";>

To generate the xsl:stylesheet element in B.xsl, I have the following
excerpt in A.xsl:

<xsl:element name="xsl:stylesheet">
  <xsl:namespace name="atom">http://www.w3.org/2005/Atom</xsl:namespace>
  <xsl:attribute name="version">1.0</xsl:attribute>
  ...
</xsl:element>

My understanding is that the xsl:namespace element in this excerpt is only
valid in XSLT 2.0.  I tried:

<xsl:attribute name="xmlns:atom">http://www.w3.org/2005/Atom</xsl:attribute>

but Saxon told me:

Error at xsl:attribute on line 22 column 40 of QueryToFeedFilter.xsl:
  XTDE0850: Invalid attribute name: {xmlns:atom}
Failed to compile stylesheet. 1 error detected.

Using XSLT 1.0, is there a way of generating the xsl:stylesheet element that
needs to be in B.xsl?

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