title: Reference an XSLT variable via a dynamic name
body: <p>I'm stuck with a small problem.</p>
  
  <p>The XSL-File:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
  &lt;xsl:stylesheet version="1.0"  
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt; 
  &lt;xsl:template match="/"&gt; 
  
  
  &lt;xsl:variable name="unumericValue" select="10" /&gt;
  &lt;xsl:variable name="uanotherValue" select="8" /&gt;
  
  
  
  &lt;xsl:for-each select="/root/try"&gt;
  &lt;xsl:value-of select="var" /&gt;
  &lt;xsl:variable name="min"&gt;&lt;xsl:value-of select="@minimum" /&gt;&lt;/xsl:variable&gt;
  &lt;xsl:value-of select="@type" /&gt;
  &lt;xsl:variable name="referenceName"&gt;&lt;xsl:value-of select='concat("u",var)' /&gt;&lt;/xsl:variable&gt;
  &lt;xsl:value-of select="$referenceName" /&gt;
  &lt;xsl:if test='$referenceName &gt; $min'&gt;
  &lt;p&gt;Do something.&lt;/p&gt;
  &lt;/xsl:if&gt;
  &lt;/xsl:for-each&gt;
  
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>The XML File:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="q1.xsl"?&gt;
  &lt;root&gt;
  &lt;try type="compare" minimum="9"&gt;
  &lt;var&gt;numericValue&lt;/var&gt;
  &lt;something&gt;...&lt;/something&gt;
  &lt;/try&gt;
  
  &lt;try type="compare" minimum="10"&gt;
  &lt;var&gt;anotherValue&lt;/var&gt;
  &lt;something&gt;...&lt;/something&gt;
  &lt;/try&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>As you can see the XML file has two var-Elements which should match to the variables in the XSLT-File. However I don't know which Syntax is correct.
  $referenceName is just the name of the variable which I want to use. But I don't know how to reference the name to the existing variable.</p>