.. _functx_change-element-names-deep:
================================
functx:change-element-names-deep
================================
Changes the names of elements in an XML fragment
Description
~~~~~~~~~~~
The functx:change-element-names-deep function changes the names of elements that
are in $nodes or among their descendants, based on a list of $oldNames to change
from, and a list of $newNames to change to. They are positionally related, e.g.
the first name in $oldNames is converted to the first name in $newNames. Names
that do not appear in the $oldNames list are unchanged.
Each name must be specified as an xs:QName value. QNames can be constructed with
calls to the xs:QName type constructor or the fn:QName function, as shown in the
examples.
.. list-table::
:widths: 40 60
:header-rows: 1
* - **Parameters**
- **Description**
* - nodes:node()
-
* - oldNames:string()
- the sequence of names to change from
* - newNames:string()
- the sequence of names to change to
Examples
~~~~~~~~
.. list-table::
:widths: 50 50
:header-rows: 1
* - **XPath**
- **Results**
* - functx:change-element-names-deep($in-xml-1, xs:QName('b'), xs:QName('y'))
- b c
* - functx:change-element-names-deep($in-xml-1, (xs:QName('a'), xs:QName('b'),xs:QName('c')), (xs:QName('x'), xs:QName('y'),xs:QName('z')))
- b c
* - functx:change-element-names-deep($in-xml-2, (xs:QName('dty:b'),xs:QName('c')), (xs:QName('q'), QName('http://new','new:c')))
- b
c
Depends On
~~~~~~~~~~
* :ref:`functx_if-empty`.
See Also
~~~~~~~~
.. toctree::
:titlesonly:
:glob:
* :ref:`functx_change-element-ns`.
* :ref:`functx_change-element-ns-deep`.