title: using generate-id() for xsl:result-document filename and linking to HTML
body: <p>I'm using xslt to transform a big xml into smaller interlinking html files. I've got troubles with the generate-id() function, as the generated id's are not the same for html href="" and the id's in the filenames</p>
  
  <p>I create the following files via xsl:result-document:</p>
  
  <blockquote>
    <p>index.html | d1e83523.html | d1e83524.html | d1e83525.html | ...</p>
  </blockquote>
  
  <p>index.html should contain a list with links to the other *.html files</p>
  
  <hr>
  
  <p><strong>index.html</strong> that I want, but all I get are different id's:</p>
  
  <pre><code>      &lt;ul&gt;
           &lt;li&gt;&lt;a href="d1e83523.html"&gt;Sample 1&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="d1e83524.html"&gt;Sample 2&lt;/a&gt;&lt;/li&gt;
           &lt;li&gt;&lt;a href="d1e83525.html"&gt;Sample 3&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>xsl</strong> to create <strong>index.html</strong>:</p>
  
  <pre><code>&lt;xsl:template match="lab/*"&gt;
      &lt;xsl:result-document encoding="utf-8" method="html" href="HTML_out/index.html" &gt;
                  &lt;html&gt;
                      &lt;head&gt;&lt;/head&gt;
                      &lt;body&gt;
                          &lt;ul&gt;
                              &lt;xsl:for-each select="chapter/heading"&gt;
                                  &lt;li&gt;
                                      &lt;a href="{generate-id()}.html"&gt;
                                          &lt;xsl:value-of select="foo"/&gt;
                                      &lt;/a&gt;
                                  &lt;/li&gt;
                              &lt;/xsl:for-each&gt;
                          &lt;/ul&gt;
                      &lt;/body&gt;
                  &lt;/html&gt;
              &lt;/xsl:result-document&gt;
   &lt;/xsl:template&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>xsl</strong> to create the other <strong>*.html</strong>:</p>
  
  <pre><code>&lt;xsl:template match="chapter/*[not(self::heading)]"&gt;
          &lt;xsl:for-each select="."&gt;
              &lt;xsl:result-document encoding="utf-8" method="html" href="HTML_out/{concat(generate-id(), '.html')}" &gt;
                  &lt;html&gt;
                      &lt;head&gt;&lt;/head&gt;
                      &lt;body&gt;
                          &lt;xsl:apply-templates/&gt;
                      &lt;/body&gt;
                  &lt;/html&gt;
              &lt;/xsl:result-document&gt;
          &lt;/xsl:for-each&gt;
      &lt;/xsl:template&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>xml-sample</strong> (note: multiple <em>description</em>-like-structured elements following)</p>
  
  <pre><code>&lt;lab&gt;
      &lt;description&gt;
          &lt;chapter&gt;
              &lt;heading&gt;Example&lt;/heading
              &lt;operation&gt;other elements&lt;/operation&gt;
              &lt;operation&gt;other elements&lt;/operation&gt;
              ...
          &lt;/chapter&gt;
          ...
      &lt;/description&gt;
  &lt;/lab&gt;
  </code></pre>
  
  <p>I'm grateful for every help!</p>
  
  <p>EDIT: I'm using generate-id() to get an unique filename for those many files</p>