You need to read about the concept of the "context node" or "context item" which represent the current position in the document. An instruction like xsl:for-each changes the context node. Relative path expressions navigate starting at the context node. So you don't want to say
Code:
<xsl:for-each select="catalog/cd/artist">
<xsl:if test="catalog/cd/country='UK'">
you should say instead
Code:
<xsl:for-each select="catalog/cd/artist">
<xsl:if test="../country='UK'">
or in this case, since the condition applies to the whole body of the for loop, you can simply select the cd's you want with a predicate select="catalog/cd[country='uk']/artist".