Required and sequential context

Optional elements

An element may be optional in some (or even all) contexts. This can be a factor in stylesheet design. For example, it would not be a good idea to arrange for a chapter Title element to force a page-break to start the new chapter, when the Title element is optional. If an element name is followed by a question mark, it is optional. In the following example, the title is optional within a Note element:

<!ELEMENT Note (Title? ...)>

The asterisk symbol is used to indicate that an element is repeatable but also optional. The Para element in the example below is therefore optional, and the note could be empty:

<!ELEMENT Note (Para*)>

Element Ordering

An element model may include elements that can appear in any order, or elements that must appear in the order shown. Ordering is predefined when the comma is used to separate element names in the model. In the following example, the Title element must appear first within a Note. As it is also required, it is possible to format the beginning of the note from the Title element template, and it may not be necessary to have a Note template at all:

   <!ELEMENT Note (Title, Para*)>


<template name="Note/Title">
  <html:H3>NOTE: <apply-templates/></html:H3>
</template>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset