Are you using XSLT 1.0 or 2.0?
I can't think immediately of any reason why the comparison should work with string() and not without it.
But you shouldn't get into the habit of writing
<xsl:variable name="nameList"><xsl:value-of select="output-flow/@class.name"/></xsl:variable>
It's very commonly done, and it's crazy. Write:
<xsl:variable name="nameList" select="output-flow/@class.name"/>
Otherwise you're creating a new temporary document node, and copying the attribute to a new text node, when all you want is a reference to the original attribute.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference