title: XSLT : Creating a Map in XSLT
body: <p>I want to have a key value map in xsl and so defined a variable which has an xml fragment, but later when I try to access the xml nodes in the variable I get an error that type of the xpath xpression cannot be resolved.</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:template match="/"&gt;
          &lt;xsl:variable name="map"&gt;
              &lt;map&gt;
                  &lt;entry key="key-1"&gt;value1&lt;/entry&gt;
                  &lt;entry key="key-2"&gt;value2&lt;/entry&gt;
                  &lt;entry key="key-3"&gt;value3&lt;/entry&gt;
              &lt;/map&gt;
          &lt;/xsl:variable&gt;
          &lt;output&gt;
              &lt;xsl:value-of select="$map/entry[@key='key-1']"/&gt;
          &lt;/output&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>