Revision [1225]

Last edited on 2010-02-15 10:11:51 by DavidLee
Additions:
||-e,-xpath xpath-expr||xpath expression||
||-m,matches matches-expr||XSLT matches expression||
Deletions:
||-xpath xpath-expr
-e xpath-expr ||xpath expression||
||-matches matches-expr
-m matches-expr ||XSLT matches expression||


Revision [1163]

Edited on 2010-02-05 14:35:22 by DavidLee
Additions:
Deletes all nodes matching the expression given
||-xpath xpath-expr
-e xpath-expr ||xpath expression||
||-matches matches-expr
-m 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
<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 "$@"
[[CommandXAddattribute xaddattribute]]
Deletions:
||match-expression||A XSLT style match expression||
||attribute-name||Name of attribute to add or replace||
||attribute-value||Value of attribute||
addattribute is a simple front end to the [[CommandXed xed]] command which adds or replaces a single attribute to all matching nodes.
The match-expression is an XSLT2.0 match expression. For all element nodes matching that expression, an attribute is added or replaced (if an attribute exists by the same name).
Example: add a comment attribute to all file elements produced by xls
xls | xaddattribute file comment "This is a file"
<file name="README.txt" path="C:/Work/DEI/xmlsh/trunk/README.txt" comment="This is a file"/>
<file name="_dist" path="C:/Work/DEI/xmlsh/trunk/_dist" comment="This is a file"/>
<file name="_out" path="C:/Work/DEI/xmlsh/trunk/_out" comment="This is a file"/>
<file name="bin" path="C:/Work/DEI/xmlsh/trunk/bin" comment="This is a file"/>
<file name="build-lib" path="C:/Work/DEI/xmlsh/trunk/build-lib" comment="This is a file"/>
<file name="build.xml" path="C:/Work/DEI/xmlsh/trunk/build.xml" comment="This is a file"/>
<file name="doc" path="C:/Work/DEI/xmlsh/trunk/doc" comment="This is a file"/>
<file name="lib" path="C:/Work/DEI/xmlsh/trunk/lib" comment="This is a file"/>
<file name="license.txt" path="C:/Work/DEI/xmlsh/trunk/license.txt" comment="This is a file"/>
<file name="notices" path="C:/Work/DEI/xmlsh/trunk/notices" comment="This is a file"/>
<file name="play" path="C:/Work/DEI/xmlsh/trunk/play" comment="This is a file"/>
<file name="samples" path="C:/Work/DEI/xmlsh/trunk/samples" comment="This is a file"/>
<file name="schemas" path="C:/Work/DEI/xmlsh/trunk/schemas" comment="This is a file"/>
<file name="src" path="C:/Work/DEI/xmlsh/trunk/src" comment="This is a file"/>
<file name="test" path="C:/Work/DEI/xmlsh/trunk/test" comment="This is a file"/>
<file name="unix" path="C:/Work/DEI/xmlsh/trunk/unix" comment="This is a file"/>
<file name="win32" path="C:/Work/DEI/xmlsh/trunk/win32" comment="This is a file"/>
<file name="xmlsh.log" path="C:/Work/DEI/xmlsh/trunk/xmlsh.log" comment="This is a file"/>
The xaddattribute command is implemented as a built-in xsh script
xed -matches "$1" -a <[ attribute { $_2 } { $_3 } ]>


Revision [1162]

The oldest known version of this page was created on 2010-02-05 14:32:26 by DavidLee
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki