About Arbortext Styler > Creating Contexts > Contexts Overview
  
Contexts Overview
Most elements have just one set of formatting properties. However, you can apply different properties to an element based on the context in which the element occurs. Arbortext Styler associates formatting properties with element contexts, rather than directly with elements.
For example, you can use contexts to change the formatting of a title element. A title in the context of a book can be formatted differently than a title in the context of a chapter.
* 
You must apply a style to an element before you can apply contexts to it.
Contexts are similar to templates in XSL stylesheets and elements-in-context (e-i-cs) in FOSI stylesheets. They are also similar to style rules in Cascading Style Sheets (CSS), but unlike CSS, Arbortext Styler does not combine properties for multiple contexts. Instead, it processes only one context for a given occurrence of an element within a document.
When you apply styles to the elements in your stylesheet, Arbortext Styler creates contexts for elements based on these styles, and also assigns default properties (such as font characteristics, spacing, and indentation).
Every element in a stylesheet has one context, the everywhere context (for example, para everywhere). The formatting specified for this context applies to all occurrences of the element within a document if the element has no other contexts configured. Once you create more than one context for an element, the everywhere context changes to everywhere else (for example, para everywhere else). The formatting specified for the everywhere else context applies to occurrences of the element that do not correspond to a configured context.
You can select an element context from within Arbortext Styler. You can also click inside an element in the document and the appropriate context is highlighted in Arbortext Styler: the Arbortext logo displays next to the context string and the context icons are highlighted in green:
This is an image showing the relationship between a title in a chapter in a document and its corresponding context description” title in chapter” in
If an element only has one context, the element is selected along with the context.
You can configure element contexts based on parent and ancestor elements. For example, you can create the context para in abstract anywhere in front, which applies to occurrences of para whose immediate parent is abstract. In this context, the parent of abstract can be any element, as long as front is its ancestor.
Each of the following situations match the para in abstract anywhere in front context:
<front>
<intro>
<abstract>
<para>
<front>
<abstract>
<para>
<front>
<preface>
<section>
<abstract>
<para>
* 
You can include User Formatting Elements and Styler Formatting Elements when creating contexts. Refer to Elements Overview for more information.
You can further refine the elements to which a context applies by specifying a position or XPath predicate for any of the elements in a context specification. Refer to Using XPath in Contexts for further information.
Arbortext Styler validates contexts against the DTD or schema in use by the current document.
You can make a context's formatting properties vary based on the presence of attribute values for the context, by assigning conditions to them. Refer to Conditions Overview for more information on conditions.