Next / Previous / Contents / TCC Help System / NM Tech homepage

4.2. The syntax of multi-namespace documents

An XML document's external form uses namespace prefixes to distinguish names from different namespaces. Each prefix's NSURI must be defined within the document, except for the blank namespace if there is one.

Here is a small fragment to give you the general idea:

<fo:inline font-style='italic' font-family='sans-serif'>
  <xsl:copy-of select="$content"/>

The inline element is in the XSL-FO namespace, which in this document uses the namespace prefix “fo:”. The copy-of element is in the XSLT namespace, whose prefix is “xsl:”.

Within your document, you must define the NSURI corresponding to each namespace prefix. This can be done in multiple ways.

Here is a small complete XHTML file with all the decorations recommended by the W3C organization:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" lang="en" xml:lang="en">
 <title>My page title</title>
  <h1>Hello world</h1>

The xmlns attribute of the html element specifies that all its descendant elements are in the XHTML 1.0 Strict namespace.

The xml:lang="en" attribute specifies that the document is in English.

Here is a more elaborate example. This is the root element of an XSLT stylesheet. Prefix “xsl:” is used for the XSLT elements; prefix “fo:” is used for the XSL-FO elements; and a third namespace with prefix “date:” is also included. This document does not use a blank namespace.