modifier
#base
#full
#xmlns
#base, #full, or #xmlns are used to modify the interpretation of
element names in element rule headers, and when inquiring about the element context.
These namespace modifiers are intended for use in programs that process XML documents that use XML namespaces.
Such documents use qualified element names: ordinary XML names with an optional namespace prefix. The prefix is
separated from the remainder of the name with a colon. For instance, in:
<author:name xmlns:author="www.some-uri.org/authors.xml">
Herman Melville
</author:name>
the element name author:name is a qualified name. author is the namespace prefix and
name is the local (or base) part of the element name. An element name like name has a base
part of name, and no prefix.
A complete description of XML namespaces is published by the W3C.
The #base, #xmlns, and #full namespace modifiers control whether the
entire element name from the input document must match, or whether only the base part of the element name will
be considered.
If none of these namespace modifiers is given, the default is that specified by the
markup-identification declaration. If there is no markup-identification declaration,
then the default is #full.
Element names in element rule headers may be prefixed with either
#base or #full. #xmlns is not permitted in this context.
When the element name is prefixed by #full, the rule will only fire when the element name in
the start tag matches in its entirety.
For example, the rule
element #full "name" output "%c"will fire when the start tag is
<name>, but not when the start tag is <author:name>.
When the element name is prefixed by #base, the rule will fire whenever the base part of the
element name in the start tag matches. For instance, the rule
element #base "name" output "%c"will fire when the start tag is
<name> as well as when the start tag is <author:name>. It ignores any namespace prefix when determining whether the rule matches.
#full, #base, or #xmlns may precede an element name when testing an
element's identity.
For example, when element is #full "name" will succeed if the name of the current element in the
input document is name, but not if the current element is author:name.
when element #base "name" will succeed if the name of the current element in the input document
is name, or if the base part of the name of the current element is name (such as author:name).
For some tests, #xmlns may be used to modify the element name. #xmlns is a more
restricted form of #base. For example, when parent is #xmlns "author" succeeds when
the base part of the element name of the parent element is author and when the parent element is
in the same local namespace as the current element. An element is in the same local namespace as the current
element if all open elements between the current element and the element being tested have the same namespace
name as the current element.
For instance,
<x:a xmlns:x="bar.org" xmlns:y="foo.org" xmlns:z="bar.org">
<y:b>
<x:c>
<z:d>
<z:e>
</z:e>
</z:d>
</x:c>
</y:b>
</x:a>
if z:e is the current element, then x:c and z:d are in its local
namespace, because they both have the same local namespace (bar.org). It does not matter that they
use different prefixes. y:b is in a different namespace (foo.org). x:a is in
the same namespace, but it is not local any more because y:b changed the namespace.
In the example above, the following are true:
open element is #xmlns "e"
open element is #xmlns "d"
open element is #xmlns "c"
false:
open element is #xmlns "b"
open element is #xmlns "a"
#full, #base, or #xmlns may also be used when identifying an element
whose properties are being referenced. For example, you can retrieve the name of an ancestor element whose
base part is a with
output name of open element #base "a"
The #xmlns namespace modifier cannot be used in:
element rules,
element is tests,
previous is tests,
last content is tests, and
last subelement is tests.