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:
The font and color to use for displaying an element.
The margins and space for the content of the element.
Whether and where to introduce automatic line breaks for an element.
Whether the element content should be displayed as an image.
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.
Settings for an element type apply to all instances of that element type in the document. For example, if you specify that the text of a title element should be displayed in red, the text of all title elements in the document will be shown in red color.
Settings for a path description apply only to elements that match this path. For example, a path description of chapter/title would match all title elements in your document that appear directly within a chapter element. If you specify that elements matching the chapter/title path should be displayed in blue, then all title elements in your document that occur within chapter elements would be shown in blue. A title element that occurs within a section element within a chapter would match a path description of chapter/section/title and would not be shown in blue.
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.