Hierarchical context

When the style of an element depends on its location in the document, it is necessary to understand what contexts are allowed by the DTD. The ELEMENT declarations provide this information.

In the example above, the Book element definition specifies that a book may contain a Title element, followed by any number of Chapter elements. One possible parent of the Title element is therefore the Book element. However, the Chapter element definition also names the Title element as its first child, and so a Title element may instead have a Chapter element parent. The Para element does not mention the Title element in its definition, and so a Title element cannot have a Para element parent. The following two templates are therefore ...

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.