APP in Arbortext Styler > Components of Documents and Templates > Tags > Namespaces in Arbortext Advanced Print Publisher
  
Namespaces in Arbortext Advanced Print Publisher
Introduction
When creating Arbortext Advanced Print Publisher documents and templates it is useful to separate tags into logical and reusable groups. This allows code to be shared between templates but also to keep some code separated from others. Arbortext Advanced Print Publisher tag namespaces allow this type of organization. Arbortext Advanced Print Publisher tag namespaces can be considered as a mechanism to define tag modules. Namespaces can also be used to support more complex requirements.
An Arbortext Advanced Print Publisher namespace is given as part of a tag name. Its name is separated from the tag name by a colon, for example the name of a para style tag within the tables namespace is tables:para. As a namespace is an Arbortext Advanced Print Publisher tag, it can exist in a namespace itself. For example, the tag name library:tables:cals:header:para could represent the paragraph style stored within a namespace for CALS table headers in a library of Arbortext Advanced Print Publisher tags.
Namespace Priority
Namespaces allow an Arbortext Advanced Print Publisher document to contain multiple tags with the same local name. The namespaced tag can be called directly by referring to its full name. It is also possible to instruct Arbortext Advanced Print Publisher to select tags from certain namespaces in preference to others, by defining a namespace search list for a document. The search list nominates the namespaces in which Arbortext Advanced Print Publisher must search for tags. It is also possible to add namespaces to, or remove them from, the search order using an inline command.
For example, a document might contain these tags:
para — the default style for the template
docbook:para — a document type-specific version of the default style
docbook:chapter:para — a specific version of the document type style for use within chapters
The document search list would specify that the docbook namespace is prioritized over the root namespace. All non-namespaced tags are placed in the root namespace (denoted by the : prefix). When Arbortext Advanced Print Publisher searches for a para tag it looks in the docbook namespace first, and use the one it finds there. In this context, the namespaced tag takes priority over the root tag. With an inline action, the docbook:chapter namespace can be added to the search list temporarily when Arbortext Advanced Print Publisher passes a chapter tag. Arbortext Advanced Print Publisher then chooses the docbook:chapter:para tag at that particular point in the formatting process.
Namespaces in the Arbortext Styler Integration
As namespaces are tags, they can be linked as well as being part of the document. A linked namespace is useful as it can be shared between other templates. In Arbortext Styler’s APP integration, three linked namespaces are used to hold a number of hard-coded tags:
_app namespace — tags to support tables
_gte namespace — Arbortext Styler’s generated text elements
_dtd namespace — Arbortext Editor’s processing instructions
Namespaces are also used very extensively throughout the generated APP code in Arbortext Styler. Use of namespaces has two principal benefits:
1. reduces the risk of tag name conflicts
2. maintains search performance even though high volumes of tags are created
Refer to APP Templates Generated from a Arbortext Styler Stylesheet for information about namespaces in the Arbortext Styler integration.
The print configuration files provided for APP in Arbortext Styler use the compose namespace. They contain scripting and print settings. The scripting is common to all, but the print settings are particular to the individual configuration file. APP uses the namespace feature of running an autoexec script when the namespace is loaded, to execute the print process based on the content of the configuration file. The print settings are stored in a namespace so the namespace search order controls any common tag names called.
Refer to Print Configuration Files for further information.