Fallback and cascading

The DOCUMENTSTYLE script command determines which style documents (Word Page Style, Word Style Sheet, HTML Page Template, or HTML Style Sheet) apply when the output of a template is created. The script command declares BRAND and DOCUMENTTYPE expressions, and they control which style documents will be selected.

BRAND and DOCUMENTTYPE are optional expressions and may be left empty.

The following algorithm is used for the style documents:

  • The style document is searched in the most specific folder.

    • If DOCUMENTTYPE is not empty, the path is: Corporate Design > <Brand> > <Document Type>.

    • If DOCUMENTTYPE is empty, the path is: Corporate Design > <Brand>.

    In case BRAND is empty, by default, it is substituted by (No Brand).

  • If the style document does not exist in the folder or even the folder does not exist, the style documents are searched in the parent folder. This process repeats until the Corporate Design folder is reached.

  • For Word Page Style, Word Style Sheet, and HTML Page Template documents, the search for style documents stops as soon as a style document is found.

  • For HTML Style Sheet documents, the search for style documents always continues until the Corporate Design folder is reached: all the style documents found are concatenated with the most specific style document being put at the bottom. Due to this rule, cascading can be used in definition of the HTML Style Sheet documents.

General rules

When you create a new project or upgrade your projects, the Corporate Design folder is filled with default style documents of each type. These default documents can be edited, but cannot be removed. As a result, each Document Template that uses the DOCUMENTSTYLE expression always has at least one style document of each type.

Document Templates without DOCUMENTSTYLE have a different behavior.

  • For Word styling, Document Templates select style documents with the old stylesheet and pagestyle calls.

  • For HTML styling, Document Templates behave as if DOCUMENTSTYLE contains an empty BRAND and an empty DOCUMENTTYPE expression.

If the DOCUMENTSTYLE expression is introduced at some point, it does not override the existing stylesheet and pagestyle function calls. These calls take precedence over the DOCUMENTSTYLE expression, but they only apply to Word output.