Information reuse

There are a number of reasons why information may need to be copied to another location in the output document. One typical example is the need to create a table of contents for a book. In this case, the chapter titles need to be copied to the beginning of the document.

Previous examples have shown how the Apply Templates element is normally used to select the children of the current element, so that the entire document can be processed in the correct order (in a tree-walking manner). However, it is also able to select material from elsewhere in the document, using the Select attribute. It has already been shown that this attribute can be used to select specific children of the current element, but as it can hold any XPath expression, ...

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.