.. _functx_remove-elements:
======================
functx:remove-elements
======================
Removes child elements from an XML node, based on name
Description
~~~~~~~~~~~
The functx:remove-elements function removes child elements from the elements in
$elements. The $names argument is a sequence of strings that represent child
element names to remove. Prefixes can (and must) be used in the $names values
for elements that are prefixed in the input documents (using the same prefix).
You can also specify wildcard values "*", "*:" and ":*" in the second argument.
See the description for functx:name-test for details.
The function does not remove all descendants, just children; see
functx:remove-elements-deep to remove all descendants with the specified names.
.. list-table::
:widths: 40 60
:header-rows: 1
* - **Parameters**
- **Description**
* - elements:element()
- the element(s) from which you wish to remove the children
* - names:string()
- the names of the child elements to remove
Examples
~~~~~~~~
.. list-table::
:widths: 50 50
:header-rows: 1
* - **XPath**
- **Results**
* - functx:remove-elements($in-xml-1, 'c')
- 123 456
* - functx:remove-elements($in-xml-1, ('a','b'))
- Mixed content
* - functx:remove-elements($in-xml-2, 'x:a')
- 123 Mixed content
Depends On
~~~~~~~~~~
* :ref:`functx_name-test`.
See Also
~~~~~~~~
.. toctree::
:titlesonly:
:glob:
* :ref:`functx_remove-elements-deep`.
* :ref:`functx_remove-elements-not-contents`.