我有很多XML文件,它们具有以下形式:
<Element fruit="apple" animal="cat" />
Run Code Online (Sandbox Code Playgroud)
我想从文件中删除.
使用XSLT样式表和Linux命令行实用程序xsltproc,我该怎么做?
到目前为止,在脚本中我已经有了包含我想要删除的元素的文件列表,因此单个文件可以用作参数.
编辑:这个问题原本缺乏意图.
我想要实现的是删除整个元素"元素",其中(fruit =="apple"&& animal =="cat").在同一文件中有许多名为"元素"的元素,我希望这些元素保留下来.所以
<Element fruit="orange" animal="dog" />
<Element fruit="apple" animal="cat" />
<Element fruit="pear" animal="wild three eyed mongoose of kentucky" />
Run Code Online (Sandbox Code Playgroud)
会成为:
<Element fruit="orange" animal="dog" />
<Element fruit="pear" animal="wild three eyed mongoose of kentucky" />
Run Code Online (Sandbox Code Playgroud)