left up right
Using the Ancestor Axis

Find out which CDs have a certain work on them

We will search all 10000 works on over 1000 CDs

We select a node-set with the 10000 works

Test each one against the text string

For those that match, we look up the ancestor tree to the grandparent cd node

Then down the child tree to the artist etc

<xsl:for-each select="cd/playlist/work">
 <xsl:choose>
   <xsl:when test=". = 'Sweet Lorraine'">
     <tr style="color:blue">
       <td><xsl:value-of select="ancestor::cd/child::artist" /></td>
       <td><xsl:value-of select="ancestor::cd/title"/></td>
       <td><xsl:value-of select="ancestor::cd/filed"/></td>
     </tr>
    </xsl:when>
    <xsl:otherwise />
  </xsl:choose>
</xsl:for-each>