Introduction

The presence of a DTD is not required for a stylesheet to be developed for use with a document collection. But creating XSL stylesheets for documents that are not controlled by a DTD would be a very dangerous task. Templates must be created for all elements that are to be presented (or hidden), and so the names of these elements must be known in advance and with certainty. With no DTD, document authors are able to create new elements as required, and the stylesheet will have no mappings for new elements.

Assuming the presence of a DTD, it can of course be ignored by the stylesheet designed. However, it is an ideal source of information as it explicitly describes all the elements that may appear and all the contexts in which they may appear. This knowledge can save a lot of effort. For example, it would be wasteful to create a template for a Title element that appears within a Note element, if the definition of the Note element in the DTD does not include the Title element as a possible child or descendant. Studying a DTD is also much faster than studying all the documents in the collection to determine what has been used (and this technique is not adequate in any case, as allowed options that may be used in the future may not have been used up to the point of the investigation).

Each stylesheet created should therefore be associated with a particular DTD. It should be designed to style documents that conform to this DTD. Of course, there may be more than one stylesheet for a given DTD, each designed to style documents that conform to this DTD in a different way.

In order to study a DTD, it is necessary to know how to interpret the instructions it contains. In particular, the way that elements and attributes are defined must be understood.

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

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