Attribute sets

Sometimes, the same set of attributes are attached to a number of output elements. For example, consider the possibility that Note, Warning and Danger elements are to be formatted in the same way, using XSL formatting attributes (explained in Chapter 17). If the specification were to change, all three of the templates below would need to be edited:

<template match="note">
  <fo:block color="blue" font-weight="bold">
    <apply-templates/>
  </fo:block>
</template>

<template match="warning">
  <fo:block color="blue" font-weight="bold">
    <apply-templates/>
  </fo:block>
</template>

<template match="danger">
  <fo:block color="blue" font-weight="bold">
    <apply-templates/>
  </fo:block>
</template>

But when the same attributes need to be attached ...

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.