【发布时间】:2010-09-24 05:24:54
【问题描述】:
我有很多具有以下形式的 XML 文件:
<Element fruit="apple" animal="cat" />
我想从文件中删除。
使用 XSLT 样式表和 Linux 命令行实用程序 xsltproc,我该怎么做?
到此为止,我已经在脚本中获得了包含我要删除的元素的文件列表,因此可以将单个文件用作参数。
编辑:这个问题最初缺乏意图。
我想要实现的是删除整个元素“元素” where (fruit=="apple" && animal=="cat")。在同一个文档中有许多名为“元素”的元素,我希望这些元素能够保留。所以
<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" />
【问题讨论】:
标签: xml xslt xslt-1.0 xslt-2.0