我不确定这是否可能。是否有可能使用 xslt,最好是 xslt 1,通过一个 xml 文件并删除一个术语,如果它是另一个术语的复数。我有这个:
<?xml version="1.0" encoding="utf-8"?>
<Zthes>
<term>
<termId>35518385342487469049732</termId>
<termUpdate>add</termUpdate>
<termName>Doctor</termName>
<termType>PT</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:47:45</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:39</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
</term>
<term>
<termId>19229419919329134598161</termId>
<termUpdate>add</termUpdate>
<termName>Doctors</termName>
<termType>ND</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:48:14</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:14</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
<relation>
<relationType>USE</relationType>
<termId>35518385342487469049732</termId>
<termName>Doctor</termName>
</relation>
</term>
<term>
<termId>179468269297128829432204</termId>
<termUpdate>add</termUpdate>
<termName>Medical Centre</termName>
<termType>PT</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:48:31</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:53</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
</term>
<term>
<termId>109697087683409264068424</termId>
<termUpdate>add</termUpdate>
<termName>Hospitals</termName>
<termType>ND</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:48:53</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:53</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
<relation>
<relationType>USE</relationType>
<termId>179468269297128829432204</termId>
<termName>Medical Centre</termName>
</relation>
</term>
</Zthes>
我希望能够查看<termName>
是否<termType>
具有状态 ND。然后,如果确实如此,请检查该<termName>
部分中的<relation>
。如果它们之间的唯一区别是其中一个以's'结尾,则删除<term>
带有状态ND的:
<?xml version="1.0" encoding="utf-8"?>
<Zthes>
<term>
<termId>35518385342487469049732</termId>
<termUpdate>add</termUpdate>
<termName>Doctor</termName>
<termType>PT</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:47:45</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:39</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
</term>
<term>
<termId>179468269297128829432204</termId>
<termUpdate>add</termUpdate>
<termName>Medical Centre</termName>
<termType>PT</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:48:31</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:53</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
</term>
<term>
<termId>109697087683409264068424</termId>
<termUpdate>add</termUpdate>
<termName>Hospitals</termName>
<termType>ND</termType>
<termStatus>active</termStatus>
<termApproval>candidate</termApproval>
<termCreatedDate>20121217T11:48:53</termCreatedDate>
<termCreatedBy>admin</termCreatedBy>
<termModifiedDate>20121217T11:48:53</termModifiedDate>
<termModifiedBy>admin</termModifiedBy>
<relation>
<relationType>USE</relationType>
<termId>179468269297128829432204</termId>
<termName>Medical Centre</termName>
</relation>
</term>
</Zthes>
XSLT 是最好的方法吗?老实说,我在这里超出了我的深度。谢谢。