.. _functx_copy-attributes:
======================
functx:copy-attributes
======================
Copies attributes from one element to another
Description
~~~~~~~~~~~
The functx:copy-attributes function copies attributes from the element in
$copyFrom to the element in $copyTo. It leaves all the original attributes and
content of $copyTo, except that if $copyTo already has an attribute with the
same name of one of $copyFrom's attributes, its value is updated to match
$copyFrom.
.. list-table::
:widths: 40 60
:header-rows: 1
* - **Parameters**
- **Description**
* - copyTo:element()
- the element to copy attributes to
* - copyFrom:element()
- the element to copy attributes from
Examples
~~~~~~~~
.. list-table::
:widths: 50 50
:header-rows: 1
* - **XPath**
- **Results**
* - functx:copy-attributes($in-xml/a, $in-xml/b)
- 123
* - functx:copy-attributes($in-xml/b, $in-xml/c)
- 456
* - functx:copy-attributes($in-xml/d, $in-xml/c)
- 123
See Also
~~~~~~~~
.. toctree::
:titlesonly:
:glob:
* :ref:`functx_add-attributes`.
* :ref:`functx_add-or-update-attributes`.
* :ref:`functx_update-attributes`.
* :ref:`functx_remove-attributes`.