How to use variables in XSLT?
===

In my xslt template I am having a foreach statement. In that foreach I am making different conditions. I want to have there a variable of string type which shall contain class attributes that will be assigned to a LI.
As I am new to xslt please provide me some examples or how can I achieve what I want to do.
Here is a bit of my code so you can see what I am taking about:

    
            <xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) &gt; '0'">
                <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
                    <li><xsl:attribute name="class">
                            topNavigLi
                            page<xsl:number value="position()" format="1" />
                            <xsl:if test="@nodeName='Network' ">
                                has_submenu network
                            </xsl:if>
                        </xsl:attribute>
                        <xsl:if test="@id = $currentPage/@id">
                            <xsl:attribute name="class">
                                current topNavigLi
                                page<xsl:number value="position()" format="1" />
                            </xsl:attribute>
                        </xsl:if>
                        <xsl:if test="position() = last()">
                            <xsl:attribute name="class">
                                last topNavigLi
                                page<xsl:number value="position()" format="1" />
                            </xsl:attribute>
                        </xsl:if>

                        <xsl:if test="@id = $currentPage/@id and position() = last()">
                            <xsl:attribute name="class">
                                current last topNavigLi
                                page<xsl:number value="position()" format="1" />
                            </xsl:attribute>
                        </xsl:if>

It would be much elegant to have a variable and than **concatenate** to it while doing tests.
I have tried like this but returns nothing.

 <xsl:variable name="li_class" select="page"> </xsl:variable>
                       
                        <xsl:attribute name="class">
                            <xsl:value-of select="li_class" /> 
                        </xsl:attribute>