xmlns
The xmlns statement allows definition of the various namespaces used within the stylesheet.
Syntax
<name space def> ::= "xmlns"
<quote> <name> <quote>
<quote> <uri reference> <quote>
Options
<prefix>
|
The id of the namespace that is used within the stylesheet. |
<reference>
|
The unique reference of the namespace, a URI reference. |
Elements
None/
Examples
Definitions are given as a list within the stylesheet definition.
stylesheet {
version "1.0"
xmlns "a" "http://relaxng.org/ns/annotation/1.0"
xmlns "dc" "http://purl.org/dc/elements/1.1/"
xmlns "xhtml" "http://www.w3.org/1999/xhtml"
}
The above "folds" the declared namespace into the <stylesheet> element.
<?xml version="1.0" encoding="UTF-8"?>
<stylesheet
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://relaxng.org/ns/annotation/1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
version="1.0"/>
Errors
The only errors here (until URI checking is added) are missing either the prefix or the uri, and a duplicate
definition (prefix is duplicated). Note that currently two definitions of the same namespace are
allowed.
stylesheet {
version "1.0"
xmlns "a" "http://relaxng.org/ns/annotation/1.0"
xmlns "dc"
xmlns "xhtml" "http://www.w3.org/1999/xhtml"
xmlns "xhtml" "http://www.w3.org/1999/xhtml"
}
would report
**** (130) Missing expression after "xmlns" in line 5
Insert expression.
**** (110) "xhtml" symbol in 7 already declared in line 6
Remove duplicate or check spelling.
Copyright 2024 Hugh Field-Richards. All Rights Reserved.