Chapter 8. Style Sheets

Table of Contents
8.1. Element Styles and XPath styles
8.2. Style inheritance
8.3. The Style Sheet Dialog
8.4. Adding new XPaths

Style sheets are used by epcEdit to determine how a document should be displayed. A style sheet is stored as a part of a template for that document type and contains settings for all documents of the type associated with the template.

Style sheets determine how the content of an element should be displayed. For example, a style sheet defines how the content of a title element should appear in documents that use that style sheet. In particular, a style sheet contains information about:

These settings can be defined for an element type on the element level or they can be specified for a path description of an element. epcEdit uses a subset of the XPath syntax to describe element paths in the document.

8.1. Element Styles and XPath styles

As of this version (1.1), epcEdit supports only a very limited subset of the XPath language. This will evolve into larger subset of supported XPath constructs in epcEdit 1.2.

Currently, an XPath statement can only consist of element names that are separated by slashes (/). The last name in the path is the name of an element that is matched by this path if the remainder of the path (up to, but not including the last name) is either empty or matches the parent element of the element.

An element in your document may be matched by 0, one, or more XPath specifications. If exactly one XPath specification matches an element, the style settings from this specification are applied to the element in question. If the element is matched by more than one XPath, the most specific path is chosen for determining how to display the element and the other path specifications are ignored.

For example, you may have specified the paths chapter/section/title, section/section/title, and section/title with different style options. If a title element occurs within a section element, the settings from the section/section/title path will be used if the title element occurs within a section element that is enclosed in another section element. The chapter/section/title path will be chosen if the title element occurs within a section that is enclosed by a chapter element, and the section/title path will be used if the title element occurs within a section element that is neither enclosed by another section nor by a chapter element.

None of these path settings will apply if the title element does not occur directly within a section element, e.g. if the title is contained in a figure element.

If an XPath matches an element, all style options that are specified for the XPath will apply to the element and override any style settings that were specified for the element type.