The rename command

Syntax:

rename expression as expression

Nodes (elements or attributes) selected by the first expression are renamed; the new name is given by computing the expression in the second argument.

The second expression is evaluated with the existing node as the context item. If the result of the expression is a string, then this string is used as the new name of the node (if it contains a prefix, this must first be declared using the namespace command). If the result of the expression is a QName, then it defines the expanded name of the new element or attribute in its entirety. New namespace declarations will be added to the output document if required; existing namespace declarations are not removed, unless new bindings are defined for existing prefixes.

Examples

rename //NOTE as "COMMENT"

renames all NOTE elements as COMMENT elements.

rename //@* as lower-case(name())

renames all attributes by converting the existing name to lower-case.