RE: [xsl] namespace declaration when generating a stylesheet

Subject: RE: [xsl] namespace declaration when generating a stylesheet
From: "Seaborne, Mark" <Mark_Seaborne@xxxxxxxxxxxx>
Date: Fri, 27 Jul 2001 14:59:48 +0200
Ta muchly

I ended up with a variation on the last suggestion:

		<xsl:for-each select="$currNode/namespace::*">
			<xsl:copy-of select="."/>

which does the job splendidly.

All the best

Mark Seaborne

-----Original Message-----
From: Michael Kay [mailto:mhkay@xxxxxxxxxxxx]
Sent: 27 July 2001 12:56
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] namespace declaration when generating a stylesheet

> I am transforming the xml document into a stylesheet via
> another stylesheet.
> The result stylesheet needs any namespace declarations that
> were in the
> source (where they will be needed).
> How do I get them there (using XSLT)? I am stumped.

Namespace nodes from the source document will be copied into the result
document when you copy an element that owns such a namespace node; they will
also be generated if you create an element or attribute that refers to the

Apart from that, the only way to get a namespace node into the result
document is to do an <xsl:copy[-of]> on a namespace node (and even then,
only if the XSLT processor implements the latest XSLT errata). One technique
is to create a result tree fragment containing the namespace node, and copy
it from there:

<xsl:variable name="rtf">
  <xsl:element name="dummy" namespace="{$required-namespace}"/>

Mike Kay
Software AG

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread