title: Trouble using XSLT variables to hold attributes
body: <p>In my xslt template I am having a <code>for-each</code> statement. In that <code>for-each</code> 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 <code>&lt;li&gt;</code>.</p>
  
  <p>As I am new to xslt please provide me some examples or how can I achieve what I want to do.</p>
  
  <p>Here is a bit of my code so you can see what I am taking about:</p>
  
  <pre><code>&lt;xsl:if test="count($currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) &amp;gt; '0'"&gt;
      &lt;xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']"&gt;
          &lt;li&gt;&lt;xsl:attribute name="class"&gt;
                  topNavigLi
                  page&lt;xsl:number value="position()" format="1" /&gt;
                  &lt;xsl:if test="@nodeName='Network' "&gt;
                      has_submenu network
                  &lt;/xsl:if&gt;
              &lt;/xsl:attribute&gt;
              &lt;xsl:if test="@id = $currentPage/@id"&gt;
                  &lt;xsl:attribute name="class"&gt;
                      current topNavigLi
                      page&lt;xsl:number value="position()" format="1" /&gt;
                  &lt;/xsl:attribute&gt;
              &lt;/xsl:if&gt;
              &lt;xsl:if test="position() = last()"&gt;
                  &lt;xsl:attribute name="class"&gt;
                      last topNavigLi
                      page&lt;xsl:number value="position()" format="1" /&gt;
                  &lt;/xsl:attribute&gt;
              &lt;/xsl:if&gt;
  
              &lt;xsl:if test="@id = $currentPage/@id and position() = last()"&gt;
                  &lt;xsl:attribute name="class"&gt;
                      current last topNavigLi
                      page&lt;xsl:number value="position()" format="1" /&gt;
                  &lt;/xsl:attribute&gt;
              &lt;/xsl:if&gt;
  </code></pre>
  
  <p>It would be much elegant to have a variable and than <strong>concatenate</strong> to it while doing tests.
  I have tried like this but returns nothing.</p>
  
  <pre><code>&lt;xsl:variable name="li_class" select="page"&gt; &lt;/xsl:variable&gt;
  
  &lt;xsl:attribute name="class"&gt;
      &lt;xsl:value-of select="li_class" /&gt; 
  &lt;/xsl:attribute&gt;
  </code></pre>