The suffix command

Syntax:

suffix expression with query

For every node N selected by the expression, the query is evaluated (with N as the context item), and its result is inserted as the last child of N. The expression must return nodes that are capable of having children (that is document or element nodes). The query must return nodes that are capable of having siblings (that is, element, text, comment, or processing instruction nodes). But if the query returns an atomic value, it is treated as a text node with the same string value.

Example

The command:

suffix //page with <copyright>Copyright (c) Saxonica 2020</page>

injects a copyright element at the end of every page.