Modes

Typically, information that is copied and reused elsewhere must also be styled in a different way (the chapter titles in this book are not as large in the table of contents as they are at the top of each chapter). This can be achieved using 'modes' to create templates that are only used in specific circumstances.

The Mode attribute is added to the Template element, and assigned a meaningful name to represent the mode this template belongs to. This attribute is also used in the Apply Templates element, but this time to select a template only from those that have a matching mode name.

All the examples above used the default mode, which does not require specific identification, but a second mode requires a unique name to identify it.

In the ...

Get XML Companion, The, Third Edition 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.