Jirka is right ... the attribute isn't being addressed.
But to be more maintainable I would have coded it along the lines of:
<xsl:when test="(@cols = count(colspec)) and (colspec[@colwidth][$number])">
<colspec colnum="{$number}" colname="{$number}"
colwidth="{colspec[@colwidth][$number]/@colwidth}"/>
</colspec>
The use of ./
is redundant and cluttering, and the simple value expressions for attributes can be coded with attribute value templates.