子ノードに基づいて親ノードを削除する方法について質問があります。 XMLファイルの構造は次の通りですXSL:子ノードが重複している親ノードを削除
:
<PlmXmlData xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:an="">
<ItemList>
<Item>
<ID>1</ID>
<Group>Group1</Group>
<Projekt>Projekt1</Projekt>
<DatasetList>
<Dataset>
<Name>Name1</Name>
<Type>TXT</Type>
<Template>None</Template>
<RelativeFilePath>FilePath1</RelativeFilePath>
<PropertyList>
<Property>
<Title>item_name</Title>
<Value>ITEM_Name</Value>
</Property>
<Property>
<Title>item_name</Title>
<Value>ITEM_Name</Value>
</Property>
</PropertyList>
</Dataset>
<Dataset>
<Name>Name1</Name>
<Type>PDF</Type>
<Template>Template1</Template>
<RelativeFilePath>FilePath1/Name1.pdf</RelativeFilePath>
<PropertyList>
<Property>
<Title>item_name</Title>
<Value>CAR1</Value>
</Property>
<Property>
<Title>item_name</Title>
<Value>CAR1</Value>
</Property>
<Property>
<Title>item_name2</Title>
<Value>CAR2</Value>
</Property>
<Property>
<Title>item_name2</Title>
<Value>CAR2</Value>
</Property>
</PropertyList>
</Dataset>
</DatasetList>
</Item>
</ItemList>
</PlmXmlData>
あなたはこの例ではTXTやPDFで異なる<Type>
ノードがある見ることができるように。 このノードには、ノード<Property>
と子ノード<Title>
と<Value>
があります。
ノード<Title>
と<Value>
をそれぞれ<Type>
の重複したエントリごとに削除したいとします。
所望の出力は次のようにする必要があります:私は、フォーラムを検索するが、フィッティング解決策を見つけるcould'ntいる
<PlmXmlData xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:plm="http://www.plmxml.org/Schemas/PLMXMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:an="">
<ItemList>
<Item>
<ID>1</ID>
<Group>Group1</Group>
<Projekt>Projekt1</Projekt>
<DatasetList>
<Dataset>
<Name>Name1</Name>
<Type>TXT</Type>
<Template>None</Template>
<RelativeFilePath>FilePath1</RelativeFilePath>
<PropertyList>
<Property>
<Title>item_name</Title>
<Value>ITEM_Name</Value>
</Property>
</PropertyList>
</Dataset>
<Dataset>
<Name>Name1</Name>
<Type>PDF</Type>
<Template>Template1</Template>
<RelativeFilePath>FilePath1/Name1.pdf</RelativeFilePath>
<PropertyList>
<Property>
<Title>item_name</Title>
<Value>CAR1</Value>
</Property>
<Property>
<Title>item_name2</Title>
<Value>CAR2</Value>
</Property>
</PropertyList>
</Dataset>
</DatasetList>
</Item>
</ItemList>
。ご協力いただきありがとうございます。
XSLT 1.0またはXSLT 2.0のいずれかを選択してください。両方を選択してください。重複を削除するには、* grouping *を検索します。おそらく、ここで最も頻繁に尋ねられるXSLTの質問です。 –