.. _functx_remove-elements-not-contents: =================================== functx:remove-elements-not-contents =================================== Removes descendant XML elements but keeps their content Description ~~~~~~~~~~~ The functx:remove-elements-not-contents function removes descendant elements from all of the nodes in $nodes based on name, but keeps the contents of the removed elements. This is useful, for example, for removing in-line formatting. The $names argument is a sequence of strings that represent element names to remove. Prefixes can (and must) be used in the $names values for elements that are prefixed in the input documents. You can also specify wildcard values "*", "*:" and ":*" in the second argument. See the description for functx:name-test for details. .. list-table:: :widths: 40 60 :header-rows: 1 * - **Parameters** - **Description** * - nodes:node() - the root(s) to start from * - names:string() - the names of the elements to remove Examples ~~~~~~~~ .. list-table:: :widths: 50 50 :header-rows: 1 * - **XPath** - **Results** * - functx:remove-elements-not-contents($in-xml-1, 'b') - b1c1 Mixed content * - functx:remove-elements-not-contents($in-xml-1, ('b','c')) - b1c1Mixed content * - functx:remove-elements-not-contents($in-xml-1, 'a') - b1 c1 Mixed content * - functx:remove-elements-not-contents($in-xml-2, 'x:b') - b1 c1 Mixed content Depends On ~~~~~~~~~~ * :ref:`functx_name-test`. See Also ~~~~~~~~ .. toctree:: :titlesonly: :glob: * :ref:`functx_remove-elements`. * :ref:`functx_remove-elements-deep`.