You'll be wanting to use the <xsl:attribute> tag then.
Code:
<table>
<xsl:attribute name="columns" select="$columnCount"/>
...
An alternative is to use Attribute Value Templates.
Code:
<table columns="{$columnCount}">
Note, in both cases you don't even need the temporary variable.
Code:
<table>
<xsl:attribute name="columns" select="count(columns/column)"/>
...
/- Sam Judson : Wrox Technical Editor -/