Wiki source for CommandXdelete

Show raw source

=====Command xdelete=====

**xdelete** Deletes nodes (element,text,attribute) from an XML document

**xdelete** [options]

Deletes all nodes matching the expression given


||-e,-xpath xpath-expr||xpath expression||
||-m,matches matches-expr||XSLT matches expression||


xdelete is a simple front end to the [[CommandXed xed]] command which deletes all matching nodes, expressed as either a XSLT matches expression or an xpath expression.

Example: delete the path attribute from all file elements from xls
xls | xdelete -m @path


Result (when run on root xmlsh directory)

<file name="README.txt"/>
<file name="_dist"/>
<file name="_out"/>
<file name="bin"/>
<file name="build-lib"/>
<file name="build.xml"/>
<file name="doc"/>
<file name="lib"/>
<file name="license.txt"/>
<file name="notices"/>
<file name="play"/>
<file name="samples"/>
<file name="schemas"/>
<file name="src"/>
<file name="test"/>
<file name="unix"/>
<file name="win32"/>
<file name="xmlsh.log"/>

The xdelete command is implemented as a built-in xsh script

xed -d "$@"

====Return Value====
Returns 0 if the command executed successfully, 1 if there was an error.
[[CommandXed xed]]
[[CommandXAddattribute xaddattribute]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki