See my XSLT 1.0 and 2.0 solution below. The problem in your code is:
<xsl:value-of select="description [@courseCode = text()]"/>
This means that you are looking for the element description
whose attribute courseCode
is the same as its text value. What I do is to save the course code in a variable and check for course
elements whose attribute is the same as this variable.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes" />
<xsl:template match="/">
<ol>
<xsl:for-each select="/school/student">
<xsl:sort data-type="text" order="ascending" select="name" />
<li>
<xsl:value-of select="name" />
<ol type="a">
<xsl:for-each select="takes">
<xsl:sort data-type="text" select="." order="ascending" />
<li>
<xsl:variable name="coursecode" select="." />
<xsl:value-of select="concat('(',.,') ')" />
<xsl:for-each select="/school/course[@courseCode = $coursecode]">
<xsl:value-of select="description" />
</xsl:for-each>
</li>
</xsl:for-each>
</ol>
</li>
</xsl:for-each>
</ol>
</xsl:template>
</xsl:stylesheet>
Patrick
2010-05-02 14:27:02