次のようなxmlがあります。私はすべての異なる通貨を見つける必要があります。以下を使用する
<xsl:for-each select="$itemPrices/Relationships/Relationship/Target
/Properties/PropertyItem[cs:Key='Currency']/cs:Value">
すべての通貨タイプを取得できましたが、重複しています。XSLT1.0を使用して個別の値を見つける必要があります。前後の兄弟を使用するソリューションに出くわしましたが、同じレベルの兄弟を取得することができました。4つのレベルのうち3つを上に移動し、同等の次の兄弟を調べるXPathを構築できませんでした。
<Relationship>
<ModelName>Entities.Relationship</ModelName>
<Properties />
<Target>
<ModelName>ItemPrice</ModelName>
<Properties>
<PropertyItem>
<Key>Currency</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">US</Value>
</PropertyItem>
<PropertyItem>
<Key>PriceValue</Key>
<Value i:type="a:decimal" xmlns:a="http://www.w3.org/2001/XMLSchema">13.51</Value>
</PropertyItem>
<PropertyItem>
<Key>ProductId</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">0600</Value>
</PropertyItem>
</Properties>
</Target>
</Relationship>
<Relationship>
<ModelName>Entities.Relationship</ModelName>
<Properties />
<Target>
<ModelName>ItemPrice</ModelName>
<Properties>
<PropertyItem>
<Key>Currency</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">US</Value>
</PropertyItem>
<PropertyItem>
<Key>PriceValue</Key>
<Value i:type="a:decimal" xmlns:a="http://www.w3.org/2001/XMLSchema">11.82</Value>
</PropertyItem>
<PropertyItem>
<Key>ProductId</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">0600</Value>
</PropertyItem>
</Properties>
</Target>
</Relationship>
<Relationship>
<ModelName>Entities.Relationship</ModelName>
<Properties />
<Target>
<ModelName>ItemPrice</ModelName>
<Properties>
<PropertyItem>
<Key>Currency</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">Canadian</Value>
</PropertyItem>
<PropertyItem>
<Key>PriceValue</Key>
<Value i:type="a:decimal" xmlns:a="http://www.w3.org/2001/XMLSchema">10.95</Value>
</PropertyItem>
<PropertyItem>
<Key>ProductId</Key>
<Value i:type="a:string" xmlns:a="http://www.w3.org/2001/XMLSchema">0600</Value>
</PropertyItem>
</Properties>
</Target>
</Relationship>
したがって、上記のXMLでは、米国とカナダを1回だけ取得する必要があります。米国を2回、カナダを1回取得する必要はありません。どうやってやるの?