XML : using generate-id() for xsl:result-document filename and linking to HTML

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

I create the following files via xsl:result-document:

index.html | d1e83523.html | d1e83524.html | d1e83525.html | ...

index.html should contain a list with links to the other *.html files


index.html that I want, but all I get are different id's:

        <ul>           <li><a href="d1e83523.html">Sample 1</a></li>           <li><a href="d1e83524.html">Sample 2</a></li>           <li><a href="d1e83525.html">Sample 3</a></li>        </ul>    

xsl to create index.html:

  <xsl:template match="lab/*">      <xsl:result-document encoding="utf-8" method="html" href="HTML_out/index.html" >                  <html>                      <head></head>                      <body>                          <ul>                              <xsl:for-each select="chapter/heading">                                  <li>                                      <a href="{generate-id()}.html">                                          <xsl:value-of select="foo"/>                                      </a>                                  </li>                              </xsl:for-each>                          </ul>                      </body>                  </html>              </xsl:result-document>   </xsl:template>    

xsl to create the other *.html:

  <xsl:template match="chapter/*[not(self::heading)]">          <xsl:for-each select=".">              <xsl:result-document encoding="utf-8" method="html" href="HTML_out/{concat(generate-id(), '.html')}" >                  <html>                      <head></head>                      <body>                          <xsl:apply-templates/>                      </body>                  </html>              </xsl:result-document>          </xsl:for-each>      </xsl:template>    

xml-sample (note: multiple description-like-structured elements following)

  <lab>      <description>          <chapter>              <heading>Example</heading              <operation>other elements</operation>              <operation>other elements</operation>              ...          </chapter>          ...      </description>  </lab>    

I'm grateful for every help!

EDIT: I'm using generate-id() to get an unique filename for those many files

No comments:

Post a Comment