Elements to style

To gain a list of all the elements that may occur in a compliant document, it is simply necessary to read the names appearing after the ELEMENT declarations. In the following example, the DTD defines just four elements, called 'Book', 'Title', 'Chapter' and 'Para':

<!ELEMENT Book    (Title, Chapter*)>
<!ELEMENT Title   (#PCDATA)>
<!ELEMENT Chapter (Title, Para*)>
<!ELEMENT Para    (#PCDATA)>

The following is a conforming document instance:

<Book>
  <Title>The Book Title</Title>
  <Chapter>
    <Title>Chapter One Title</Title>
    <Para>First paragraph.</Para>
    <Para>Second paragraph.</Para>
  </Chapter>
  <Chapter>
    <Title>Chapter Two Title</Title>
    <Para>First paragraph.</Para>
    <Para>Second paragraph.</Para>
  </Chapter>
</Book

A template could be ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.