I am trying to use XSLT variables and not having much success, hopefully I'm just doing something dumb.
I have the following code snippet:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
version="1.0">
<xsl:template match="/">
<xsl:variable name="config" select="query/@config"></xsl:variable>
so I expect there to be a variable 'config' set to the value of the 'config' attribute of my top-level element 'query'.
I then try to use the variable later in my stylesheet, for example:
<a href="localhost/test?go">
{$config}
</a>
but the output I see in my output HTML document is:
<a href="localhost/test?go">
{$config}
</a>
so the value has not been substituted as I would have expected.
I think this is pretty much the simplest case there could be, so I'm doing domething stupid! Please help, thanks!
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!
If I could I would accept two answers, the one I have, and @Aaron Digulla's, which explained the attributes thing.