Copy-through attributes

One of the most beneficial ways that expressions can be used here is to copy a value from a source attribute to an output attribute. Although the element and attribute names are different in the output document, the attribute values often remain the same. A typical example of this is the need to copy an image file name and the dimensions of the image. In this example, the source Image element uses Name, Y and X attributes for the purpose:

<image name="boat.gif" y="60mm" x="40mm"/>

This element needs to be converted to the HTML IMG element as follows:

<IMG SRC="boat.gif" HEIGHT="60mm" WIDTH="40mm"/>

To do this, the three values 'boat.gif', '60mm' and '40mm' need to be copied from the source attributes to the output ...

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.