PTC ALD in Arbortext Styler > Components of Documents and Templates > Tags > Namespaces in PTC Arbortext Layout Developer
Namespaces in PTC Arbortext Layout Developer
When creating PTC Arbortext Layout Developer 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. PTC Arbortext Layout Developer tag namespaces allow this type of organization. PTC Arbortext Layout Developer tag namespaces can be considered as a mechanism to define tag modules. Namespaces can also be used to support more complex requirements.
An PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer tags.
Namespace Priority
Namespaces allow an PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer 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 PTC Arbortext Layout Developer passes a chapter tag. PTC Arbortext Layout Developer 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 PTC ALD 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 PTC ALD 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 PTC ALD Templates Generated from a Arbortext Styler Stylesheet for information about namespaces in the Arbortext Styler integration.
The print configuration files provided for PTC ALD 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. PTC ALD 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.