title: Issue using current() in xsl:for-each to retrieve nodes which are out of for-each's scope
body: <p>Hi I am a beginner in XSLT2.0 but as XML config is required in a recent project I would give it a try.
  The XML structure will look like this:</p>
  
  <pre><code>&lt;bookstore&gt;
  &lt;books&gt;
      &lt;book author="a" title="a1"/&gt;
      &lt;book author="b" title="b1"/&gt;
      &lt;book author="c" title="c1"/&gt;
      &lt;book author="d" title="d1"/&gt;
  &lt;/books&gt;
  &lt;topAuthorList&gt;
      &lt;thisMonth&gt;c,a,d,b&lt;/thisMonth&gt;
  &lt;/topAuthorList&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the XSLT looks like this:</p>
  
  <pre><code>    &lt;xsl:template match="/bookstore"&gt;
      &lt;result&gt;
          &lt;xsl:variable name="varList"&gt;
              &lt;xsl:value-of select="topAuthorList/thisMonth"&gt;&lt;/xsl:value-of&gt;
          &lt;/xsl:variable&gt; 
  
          &lt;test&gt;
              &lt;xsl:value-of select="books/book[@author='a']/@title"&gt;&lt;/xsl:value-of&gt;
          &lt;/test&gt;
  
          &lt;books&gt;
              &lt;xsl:for-each select="tokenize($varList, ',')"&gt;
                  &lt;xsl:value-of select="books/book[@author=current()]/@title"&gt;&lt;/xsl:value-of&gt;
              &lt;/xsl:for-each&gt;
          &lt;/books&gt;
      &lt;/result&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>But in XMLSpy (ver 2011 rev3) it give me the error msg:</p>
  
  <pre><code>XSLT 2.0 Debugging Error: Error in XPath 2.0 expression (Type error XPTY0004: Expected a node - current item is 'c' of type xs:string)
  </code></pre>
  
  <p>I have search google and this site many times and couldn't find the answer. I have even tried using call-template, i.e. pass the current() as param and let the second template to handle the node selection, but still the same error.</p>