Revision [1163]
This is an old revision of CommandXdelete made by DavidLee on 2010-02-05 14:35:22.
Command xdelete
Name
xdelete Deletes nodes (element,text,attribute) from an XML documentSynopsis
xdelete [options]Deletes all nodes matching the expression given
Options
-xpath xpath-expr -e xpath-expr | xpath expression |
-matches matches-expr -m matches-expr | XSLT matches expression |
Description
xdelete is a simple front end to the 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)
<dir>
<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"/>
</dir>
<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"/>
</dir>
Implementation
The xdelete command is implemented as a built-in xsh scriptxed -d "$@"
Return Value
Returns 0 if the command executed successfully, 1 if there was an error.Commands
xed
xaddattribute
CategoryCommands
CommandsPosix