我有很多XML文件,它们的形式如下:
<Element fruit="apple" animal="cat" />
我想把它从文件中删除。
使用XSLT样式表和Linux命令行实用程序xsltproc,我该如何做呢?
至此,在脚本中,我已经有了包含我希望删除的元素的文件列表,因此可以将单个文件用作参数。
编辑:这个问题最初是缺乏意图的。
我想要实现的是删除整个元素" element“where (猫”fruit==“&& animal=="cat")。在同一文档中有许多名为"Element“的元素,我希望这些元素能够保留下来。所以
<Element fruit="orange" animal="dog" />
<Element fruit="apple" animal="cat" />
<Element fruit="pear" animal="wild three eyed mongoose of kentucky" />
会变成:
<Element fruit="orange" animal="dog" />
<Element fruit="pear" animal="wild three eyed mongoose of kentucky" />
https://stackoverflow.com/questions/321860
复制相似问题