Skip to content

xsl:namespace

Creates a namespace node on the nearest enclosing result element, declaring an in-scope namespace prefix.

<xsl:namespace name="svg" select="'http://www.w3.org/2000/svg'"/>

Used when a result element needs a namespace declaration that is not implied by an existing element or attribute name. As with xsl:attribute, the instruction must run before any non-attribute / non-namespace content is written to the parent element.

Attributes

Attribute Description
name Prefix as an AVT (empty string for the default namespace). Required.
select XPath expression for the namespace URI.

Example

<root>
  <xsl:namespace name="x" select="'http://example.com/x'"/>
  <xsl:namespace name="y" select="'http://example.com/y'"/>
  ...
</root>