System variables

The following variables may appear in custom content.

Generated files

The following variables may be used to insert the output paths for files generated during typesetting. See the User Guide for information on how to set these. Note that using one of these variables will generate an error if the corresponding generated file has not been defined.

  • {document-file} — the path to the user defined Export Document file.

  • {toc-file} — the path to a user defined Export Table of Contents file.

  • {xref-file} — the path to a user defined Export XREF file.

  • {index-file} — the path to a user defined Export Index file.

  • {leaf-indicators} — the path to a user defined Export Leaf Indicators file.

  • {live-pages} — the path to a user defined Export list of active pages in a looseleaf or change pages update.

Tag specific

The following variables are declared within the context of a tag:

  • {content-model} — specifies the content model applied to the tag being mapped. The value is one of element, mixed, or preserve.

  • {tag-name} — the name of the tag being mapped.

  • {tag-parent} — the name of the parent tag of the tag being mapped.

  • {tag-context} — A path indicating the ancestry of the tag being mapped. It consists of the names of ancestor tags separated by / characters. The tag context path does not include the name of the tag being mapped.

  • {tag-occurrence} — an integer value that specifies the tag sequence number within the current parent tag. You can use this to index entries when mapping a tag as a label, and you need to construct a list-item index for the label value.

    Note that the sequence number relates to other tags with the same {tag-name}. For example, if a chapter contains a title and several paras, then both the title and the first para would have a {tag-occurrence} of 1.

  • {tag-id} — specifies the integer value of a unique identifier generated by the composition engine when processing the current tag. You can use this in the absence of tag attribute IDs to target a specific document tag.

  • {previous-token} — identifies the previous token in the input stream. The value is either a tag name or the string #PCDATA for non-whitespace content.

    A start tag token is identified by the tag name, and end tag or empty tag is identified by a leading / followed by the tag name. In a pre content tag customisation, {previous-token} identifies the token processed before the mapped start tag. In a post content tag customisation, {previous-token} identifies the token processed immediately before the mapped end tag.

  • {language} — contains the language part of the language identifier defined by the xml:lang attribute or the text-properties command. This value is used when applying language specific hyphenation, line breaking rules, text directionality, and typeface selection schemes.

    The value of this variable is taken from the part before the first “-” in the language identifier, or the entire identifier if there is no such character. The value is forced to lower case and truncated to no more than 2 characters.

    Example: A tag that declares the value of xml:lang as EN-US sets the {language} variable to en.

  • {locale} — contains the language identifier defined by the xml:lang attribute or the text-properties command.

    Example: A tag that declares the value of xml:lang as EN-US sets the {locale} variable to EN-US.

Partition specific

  • {keywords} — the partition keywords string. Partition keywords provide a simple way to describe the partition document. The keyword string is automatically written to any PDF output created from the partition.

  • {total-pages} — Specifies the number of pages produced last time the partition was typeset.

    Note that if you intend to reference this value, you must typeset the document twice — once to calculate the total number of pages, and a second time to reference the calculated total page count.

    For example, to print page numbers such as "Page 12 of 45" on each page of a document then you could declare:

    <folio/> of {total-pages}

    within a page header or footer, then typeset the document twice.

Page specific

The following variables track characteristics of the current page. They can be referenced from within the context of a header or footer fixed block or a data block link line:

  • {page-sequence} —the page sequence number. The first page produced by the composition engine is 1, the second is 2, and so on.

  • {page-side} — the page side. The value is one of front, back, or blank.

  • {page-final} — indicates if the page is the final output page produced by the composition engine. The value is either yes, or no.

The following example emits a title if the final page is a blank back:

<if var="page-final" target="yes" >
	<if var="page-side" target="blank" >
		<Title>END OF DOCUMENT</Title>
	</if>
</if>
	

Page type specific

The following variables describe characteristics of the currently selected page type:

  • {page-type} — The name of the page type used by the current segment, or when processing headers and footers, the name of the page type from which fixed blocks are taken (by default, this will be the page type used in the last segment on a page).

  • {page-orientation} — The page orientation for the current segment, or when processing headers and footers, the orientation of the page type from which fixed blocks are taken (by default, this will be the page type used in the last segment on a page). The value is either portrait or landscape.

The following example emits a page title if the current page orientation is landscape:

<if var="page-orientation" target="landscape" >
	<Title>LANDSCAPE PAGE</Title>
</if>