title: Why aren't my XSLT variables substituting their values?
body: <p>I am trying to use XSLT variables and not having much success, hopefully I'm just doing something dumb.</p>
  
  <p>I have the following code snippet:</p>
  
  <pre><code>&lt;xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xalan="http://xml.apache.org/xslt"
    version="1.0"&gt;
  
      &lt;xsl:template match="/"&gt;
        &lt;xsl:variable name="config" select="query/@config"&gt;&lt;/xsl:variable&gt;
  </code></pre>
  
  <p>so I expect there to be a variable 'config' set to the value of the 'config' attribute of my top-level element 'query'.</p>
  
  <p>I then try to use the variable later in my stylesheet, for example:</p>
  
  <pre><code>&lt;a href="localhost/test?go"&gt;
      {$config}
  &lt;/a&gt;
  </code></pre>
  
  <p>but the output I see in my output HTML document is:</p>
  
  <pre><code>&lt;a href="localhost/test?go"&gt;
      {$config}
  &lt;/a&gt;
  </code></pre>
  
  <p>so the value has not been substituted as I would have expected.</p>
  
  <p>I think this is pretty much the simplest case there could be, so I'm doing domething stupid! Please help, thanks!</p>
  
  <hr>
  
  <p>UPDATE thanks to all who responded, I misunderstood the different contexts of whether I was working in an attribute or outside. Sorted my problem out nicely!</p>
  
  <p>If I could I would accept two answers, the one I have, and @Aaron Digulla's, which explained the attributes thing.</p>