I have an xml that looks like the following. I need to find all the distinct Currencies. Using the following
<xsl:for-each select="$itemPrices/Relationships/Relationship/Target
/Properties/PropertyItem[cs:Key='Currency']/cs:Value">
I have been able to get all the currency types, but there are duplicates. I need to find distinct values using XSLT 1.0. I came across solution that used preceding and following siblings, but I was able to get siblings at the same level. I was unable to construct an XPath that would go three of four level up and then look at the comparable next sibling.
<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>
So in the above XML, I should get US and Canada just once, not US twice and Canada once. How can I do that?