Q:

How do I use the value of XSLT variables?

I am trying to learn XSLT. I am simply getting crazy. Variables should be declared within xsl:variables entity and instantiated with their names having the $ symbol just before them (like perl variables), right? Why on earth this code:
<xsl:stylesheet version="1.0"  
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
        <xsl:variable name="color" select="'red'" />
        <p>$color</p>
    </xsl:template>
</xsl:stylesheet>

results in the literal string: "$color" being written parsing a simple non empty xml document using the msxsl parser? Many thanks

A:

Use <xsl:value-of select="$color"/> instead of writing $color directly to the document.
See also this question.

A:

Also, within attributes you can get to the values directly like this:
<span style="color:{$color}" />

