1
我需要有關XSL的幫助節點,請在下面找到刪除XML的依賴於另一個節點ID使用XSL
<TEST xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:i="http://www.w3.org/2001/XMLSchemainstance">
<TEST>
<TEST1>
<TEST2>
<A>
<Rule>e1fa7f63820a406bb97f1c1b11af8d09</Rule>
<MountPoint>0</MountPoint>
</A>
<A>
<Rule>917271928cea4a75bdfa903b49ed23e5</Rule>
<MountPoint>0</MountPoint>
</A>
<A>
<Rule>6b6336722d574e8285b73192ea057b45</Rule>
<MountPoint>0</MountPoint>
</A>
</TEST2>
</TEST1>
<CHECK>
<CHECK1>
<Rule>
<Name>test1</Name>
<ID>6b6336722d574e8285b73192ea057b45</ID>
<Type>DicomHeaderAttribute</Type>
<Category>SeriesDate</Category>
<Operator>Equals</Operator>
<Value>as</Value>
</Rule>
<Rule>
<Name>sdsd</Name>
<ID>e1fa7f63820a406bb97f1c1b11af8d09</ID>
<Type>DicomHeaderAttribute</Type>
<Category>SeriesInformation</Category>
<Operator>Equals</Operator>
<Value>sdsdsd</Value>
</Rule>
<Rule>
<Name>fdfdf</Name>
<ID>917271928cea4a75bdfa903b49ed23e5</ID>
<Type>DicomHeaderAttribute</Type>
<Category>ReferringPhysician</Category>
<Operator>Equals</Operator>
<Value>assd</Value>
</Rule>
</CHECK1>
</CHECK>
</TEST>
</TEST>
我的XML在上面的XML我需要刪除與類別值,作爲匹配規則'SeriesInformation'
,以及相應的 'A' 點,其與'SeriesInformation'
規則的ID匹配時,
預期的XML:
<TEST xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:i="http://www.w3.org/2001/XMLSchemainstance">
<TEST>
<TEST1>
<TEST2>
<A>
<Rule>917271928cea4a75bdfa903b49ed23e5</Rule>
<MountPoint>0</MountPoint>
</A>
<A>
<Rule>6b6336722d574e8285b73192ea057b45</Rule>
<MountPoint>0</MountPoint>
</A>
</TEST2>
</TEST1>
<CHECK>
<CHECK1>
<Rule>
<Name>test1</Name>
<ID>6b6336722d574e8285b73192ea057b45</ID>
<Type>DicomHeaderAttribute</Type>
<Category>SeriesDate</Category>
<Operator>Equals</Operator>
<Value>as</Value>
</Rule>
<Rule>
<Name>fdfdf</Name>
<ID>917271928cea4a75bdfa903b49ed23e5</ID>
<Type>DicomHeaderAttribute</Type>
<Category>ReferringPhysician</Category>
<Operator>Equals</Operator>
<Value>assd</Value>
</Rule>
</CHECK1>
</CHECK>
</TEST>
</TEST>
請XSL幫助。
嗨,這是使用
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Rule[Category = 'SeriesInformation']">
</xsl:template>
</xsl:stylesheet>
IAM不能後轉發XSL IAM ,,亞姆能夠刪除以類別爲SeriesInformation相匹配的規則,但在那之後如何刪除 在A節點根據ID IAM無法做到
喜添,太謝謝你了...工程....再次感謝你 – user3815305 2014-09-04 12:57:52
@user不要忘記接受答案,如果它解決了你的問題! – Tomalak 2014-09-04 13:20:54