Moving information

Moving information to another location in the output document structure can be achieved by first copying it, using the techniques described above, and then suppressing it at the original location. Again, the Mode attribute is used. The essential difference is that the default template does not contain the Apply Templates element, and so the information is not output in its original location:

<xsl:template match="title">
  <!-- SUPPRESSED OUTPUT AT ORIGINAL LOCATION -->
</xsl:template>
<xsl:template match="title" mode="new-location">
  <P><xsl:apply-templates/></P>
</xsl:template>

However, this technique is quite complex and should only be considered when the new location is far removed from the source. Reordering within a small ...

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.