title: Match conditionally upon current node value
body: <p>Given the following XML:</p>
  
  <pre><code>&lt;current&gt;
    &lt;login_name&gt;jd&lt;/login_name&gt;
  &lt;/current&gt;
  &lt;people&gt;
    &lt;person&gt;
      &lt;first&gt;John&lt;/first&gt;
      &lt;last&gt;Doe&lt;/last&gt;
      &lt;login_name&gt;jd&lt;/login_name&gt;
    &lt;/preson&gt;
    &lt;person&gt;
      &lt;first&gt;Pierre&lt;/first&gt;
      &lt;last&gt;Spring&lt;/last&gt;
      &lt;login_name&gt;ps&lt;/login_name&gt;
    &lt;/preson&gt;
  &lt;/people&gt;
  </code></pre>
  
  <p>How can I get "John Doe" from within the current/login matcher?</p>
  
  <p>I tried the following:</p>
  
  <pre><code>&lt;xsl:template match="current/login_name"&gt;
    &lt;xsl:value-of select="../people/first[login_name = .]"/&gt;
    &lt;xsl:text&gt; &lt;/xsl:text&gt;
    &lt;xsl:value-of select="../people/last[login_name = .]"/&gt;
  &lt;/xsl:template&gt;
  </code></pre>