swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax    
modifier  

#base, #full, #xmlns

 
 

Syntax

  #base
  #full
  #xmlns


Purpose

#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 modifiers are intended for use in programs that process XML documents that use XML namespaces. Briefly, such documents use "qualified" element names, which are just 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 part (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 can be found at http://www.w3.org/TR/1999/REC-xml-names-19990114/

The #base, #xmlns, and #full 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 modifiers is given, then 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 rule headers

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 element 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:

  element #base "name"
     output "%c"
will fire when the start tag is "<name>", and when the start tag is "<author:name>". It ignores any namespace prefix when determining whether the element rule matches.

Inquiring about the element context

#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.

In the following example:

  <x:a xmlns:x="bar.org" xmlns:y="foo.org" xmlns:z="bar.org">
     <y:b>
      <x:c>
         <z:d>
          <z:d>
          </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:

and the following are false:

#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 modifier cannot be used in:

    Related Syntax
   #xmlns-names
   xmlns-name
   xmlns-change
   markup-identification
 
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:44:51 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.