My XML basically look something like this:

     <Row alphakey="doejohn" building="abc" class="Algebra" />
     <Row alphakey="doejohn" building="abc" class="Geometry" />
     <Row alphakey="personbob" building="abc" class="Calculus" />
     <Row alphakey="personbob" building="abc" class="Precalc" />

And my code looks a little like this:

<xsl:for-each select="$Rows">
     <xsl:if test="not(@alphakey = preceding-sibling::Rows[1]/@alphakey)">

For some reason, the test always comes back as true, no matter what. What I need it to do in this situation is only process the first instance of each teacher, and skip the rest. I have also tried this meathod...

<xsl:for-each select="$Rows">
     <xsl:variable name="akey" select="@alphakey"/>
     <xsl:if test="not(preceding-sibling::Rows[@alphakey=$akey])">

And the same thing happens. What am I doing wrong?