About Arbortext Styler > Working with Elements in Your Stylesheet > Elements Overview > Namespaced Elements
  
Namespaced Elements
XML (optionally) allows for element names to exist within a declared namespace. An element in a document can be namespaced via two mechanisms:
1. Its name may be written with an explicit prefix (separated from the element's name by a colon), for example ns:elementname
2. It may be unprefixed but be within the scope of a default namespace declaration. Certain document types define a default namespace so that all elements within that document type are namespaced.
When an Arbortext Styler stylesheet is written for a set of namespaced elements, all those elements will be prefixed in the stylesheet regardless of whether they are usually prefixed in a document of this doctype or not.
When you add namespaced elements to a stylesheet, the element names in the stylesheet can be generated according to the following rules
If the namespaced element is in the document type's default namespace, Arbortext Editor displays the element without a prefix, but Arbortext Styler adds a special prefix to the name ( _: ). For example, Arbortext Styler would change html to _:html.
If the namespaced element has a prefix, Arbortext Styler uses the prefix in the stylesheet. For example, ns:graphic will be added as ns:graphic.
If you enter a prefixed/namespaced element or attribute with a prefix from which Arbortext Styler cannot determine a unique namespace declaration, Arbortext Styler will prompt you to enter the namespace name (URI) by presenting the Add Namespace Declarations dialog box. If you enter a URI that is already associated with another prefix, that existing prefix will be used.
You may not enter _gte: or _sfe: as a namespace prefix, since these are reserved in Arbortext Styler to represent generated text elements or Styler Formatting Elements it generates or uses.
Arbortext Styler will use a different prefix than the one specified in the document if the prefix has already been defined in the stylesheet. So, for example, Arbortext Styler may change ns:figure to ns3:figure.
The use of modular stylesheets means that there is a potential for conflicts in namespace declaration in a single stylesheet:
Different prefixes mapped to the same namespace URI
Same prefix mapped to different namespace URIs (note: this is not legal according to the XML Namespace specification)
In the former case Arbortext Styler attempts to determine the correct namespace URI for any prefix and thereby maintain the expected precedence relationship between element definitions of namespaced elements. This is carried out when a stylesheet is loaded via a validation procedure, which ensures that namespace declarations from the user document or document type are declared in all modules of the stylesheet. It also checks that namespace declarations from each module in all other modules of the stylesheet. In the event that a conflict is detected, Arbortext Styler renames the prefix for the declaration being added and provides you with a message that confirms that the rename has taken place. Arbortext Styler will largely continue to work correctly with renamed prefixes. In the latter case, though, Arbortext Styler will issue an error if it encounters any such occurrences. It is essential that conflicts of this nature are corrected as soon as possible. – it will be easier for you to recognize and track element names in the UI if namespace prefix usage is kept consistent.
When working with a modularized stylesheet, if two modules in a single stylesheet use different prefixes for the same namespace this will have an effect on the order in which elements are listed in the Elements list. Since elements are displayed with the prefix for the namespace that applies in the module in which the element definition occurs, definitions for the same element may not be displayed adjacent to each other in the list. Their precedence relationship will be maintained, however.