title: XSLT: Iterating through all value of a xsl:key map
body: <p><strong>XML</strong></p>
  
  <pre><code>&lt;books&gt;
    &lt;book title="XML Today" author="David Perry" release="2016"/&gt;
    &lt;book title="XML and Microsoft" author="David Perry" release="2015"/&gt;
    &lt;book title="XML Productivity" author="Jim Kim" release="2015"/&gt;
  &lt;/books&gt;
  </code></pre>
  
  <p>The following XSL code iterates through all books by <em>David Perry</em>.</p>
  
  <p><strong>XSL</strong></p>
  
  <pre><code>&lt;xsl:key name="title-search" match="book" use="@author"/&gt;
  
  &lt;xsl:template match="/"&gt;
     &lt;HTML&gt;
        &lt;BODY&gt;
          &lt;xsl:for-each select="key('title-search', 'David Perry')"&gt;
           &lt;DIV&gt;
           &lt;xsl:value-of select="@title"/&gt;
           &lt;/DIV&gt;
        &lt;/xsl:for-each&gt;
        &lt;/BODY&gt;
     &lt;/HTML&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p><strong>HTML output</strong></p>
  
  <pre><code>&lt;HTML&gt;
    &lt;BODY&gt;
      &lt;DIV&gt;XML Today&lt;/DIV&gt;
      &lt;DIV&gt;XML and Microsoft&lt;/DIV&gt;
    &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>Now I would like to iterate not only through all books by <em>David Perry</em> but through all books by any author.
  How would a corresponding outer loop look like? 
  Or in other words: How do I iterate through all values of my <em>title-search</em> key.</p>
  
  <p>The output should be something like this:</p>
  
  <pre><code>&lt;HTML&gt;
    &lt;BODY&gt;
      &lt;H1&gt;David Perry&lt;/H1&gt;
      &lt;DIV&gt;XML Today&lt;/DIV&gt;
      &lt;DIV&gt;XML and Microsoft&lt;/DIV&gt;
      &lt;H1&gt;Jim Kim&lt;/H1&gt;
      &lt;DIV&gt;XML Productivity&lt;/DIV&gt;
    &lt;/BODY&gt;
  &lt;/HTML&gt;
  </code></pre>