Namespaces and XSLT

Since the XSLT stylesheet and the file it operates on are both XML documents, we need some way to distinguish between more than one set of XML element names. Each set of names is called a namespace.

The solution to this problem is to define a two-part element name:


The namespace defines which set of element names we're talking about, and element-name is the element name inside that namespace.

In an XSLT stylesheet, any element name that doesn't have an xsl: prefix represents an element (with its content, if any) that gets written to the output.

Besides the xsl: namespace and the namespace of the elements you are writing to the output, you may also use other namespaces. You can control which namespaces are output and which are acted on: see the section on the attributes of the root element, below.

For an example of a situation where you need to refer to other namespaces, see the section on extension elements below.