O'Reilly logo

XML Companion, The, Third Edition by Neil Bradley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Contextual rules

There may be occasions where the style of an element should depend on where it appears within the document. For example, an XML DTD may define an element called Title, which is used to hold the title text of a book, its chapters, their embedded sections and all tables. Typically, the style of the title text should vary, depending on where it is applied. A book title would, for example, be larger than a section title. Reflecting this requirement in a stylesheet is known as contextual style mapping:

<book>
  <title>The Book Title</title>
  <chapter>
    <title>The First Chapter</title>
    <section>
      <title>The First Section</title>
      <table>
        <title>A Table</title>
        ...
      </table>
      ...
    </section>
    ...
  </chapter>
  ...
</book>

Broad context

The simplest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required