XLST Key Question

Hi All,

Assume I have the following XML file:

[I]<store>
<products>
<product id=“01” name=“widget 1”>
<product id=“02” name=“widget 2”>
</products>
<customers>
<customer pid=“01” name=“Tom” country=“canada”>
<customer pid=“02” name=“Bill” country=“USA”>
<customer pid=“03” name=“Bruce” country=“canada”>
</customers>
<customers>

</products>
</store>
[/I]

What I want to do is for each customer that has a country of “Canada”, match the IDs and return products name.

I know the overall code should look something like this:

[I]<xsl:key name=“productKey” match=“customer” use=“@pid”/>

<xsl:template match=“product”>

<xsl:if test=“key(‘productKey’, @id)”>
<xsl:value-of select=“./@name”/>
</xsl:if>
</xsl:template>[/I]

However, I cannot for the life of me figure out how to put the condition on it to only select customers from Canada. I guess I want to write something like this <xsl:key name=“productKey” match=“customer” use=“@pid WHEN country=“CANADA””/>

How would I go about accomplishing this? (btw, I quickly did up that example XML and XLST without checking it for any errors…ignore any typos!).