DefaultNamespaceDecl

Declare a default namespace.


Syntax

DefaultNamespaceDecl

graphics/DefaultNamespaceDecl.png

StringLiteral

Description

A DefaultNamespaceDecl is part of a prolog and declares a default namespace in order to use unprefixed QNames. It consists of the keyword sequence declare default, followed by either of the keywords element or function, the keyword namespace, and a string literal representing the namespace URI.

As the syntax suggests, you can declare a default namespace for elements as well as functions. However, a prolog must not contain more than one of each kind of declaration. If no default function namespace is declared, it is the namespace of the XQuery/XPath functions, http://www.w3.org/2002/08/xquery-functions, which is prefixed by "fn" and "xf".

Note:
The syntax variant without the keyword declare, but with the equals sign, was used in previous versions of the W3C XQuery specification as well as in Tamino. It has been retained for compatibility reasons.

Examples

  • Declare a default namespace for mathematical functions:

    declare default function namespace "http://www.examples.com/math-functions"
  • Declare company-internal namespace for elements:

    declare default element namespace "http://company.dot.com/namespaces/corporate"

Related Syntax Construct

The following construct(s) refer to this construct:

This construct is also related to the following construct(s):

NamespaceDecl