functx:remove-elements-deep

Removes descendant elements from an XML node, based on name

Description

The functx:remove-elements-deep function removes descendant elements from all of the nodes in $nodes based on name. 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.

Parameters

Description

nodes:node()

root(s) to start from

names:string()

the names of the elements to remove

Examples

XPath

Results

functx:remove-elements-deep($in-xml-1, ‘b’)

<in-xml> <a> <c>c1</c> </a> <c>Mixed </c> </in-xml>

functx:remove-elements-deep($in-xml-1, ‘a’)

<in-xml> <c>Mixed <b>content</b> </c> </in-xml>

functx:remove-elements-deep($in-xml-1, (‘b’,’c’))

<in-xml> <a/> </in-xml>

functx:remove-elements-deep($in-xml-2, ‘x:b’)

<in-xml> <a> <c>c1</c> </a> <c>Mixed <b>content</b> </c> </in-xml>

Depends On

See Also