[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Creating namespace declarations


Subject: RE: [xsl] Creating namespace declarations
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 13 Jun 2001 11:34:30 +0100

> this is more a request for confirmation than a real question ...
> Am I right, that there's no way in XSLT 1.0 to create
>
> <example xmlns:ns="urn:namespace" value="ns:something" />
>
> if "urn:namespace" should be provided as a parameter (i.e.
> there aren't
> namespace nodes for this namespace, neither in the XML source
> nor in the stylesheet).
>
You are right. The requirement is recognized in the published XSLT 2.0
requirements.

You can get close in XSLT 1.0 (+errata) by creating an external document
dd.xml

<doc xmlns:ns="urn:namespace/>

and doing

<example>
  <xsl:copy-of select="document('dd.xml')/doc/namespace::ns"/>
  <xsl:attribute name="value">ns:something</xsl:attribute>
</example>

But it's probably simpler to create a dummy attribute in the required
namespace.

Mike Kay
Software AG


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords