Continuing my previous question.
XML
<albums>
<album title="new_zealand">
<album title="auckland">
<image title="mt_eden_railroad_station"/>
</album>
</album>
</albums>
Expected output
<div>
<a href="#new_zealand">new_zealand</a>
</div>
<div id="new_zealand">
<a href="#new_zealand/auckland">auckland</a>
</div>
<div id="new_zealand/auckland">
<img id="new_zealand/auckland/mt_eden_railroad_station"/>
</div>
XSL, that doesn't work
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="/albums | //album"/>
</xsl:template>
<xsl:template match="albums | album">
<div>
<xsl:attribute name="id">
<!-- I need to insert '/' between all parents titles and concat them. -->
</xsl:attribute>
<xsl:apply-templates select="album/@title | image"/>
</div>
</xsl:template>
<xsl:template match="album/@title">
<a href="{concat('#', .)}">
<xsl:value-of select="."/>
</a>
</xsl:template>
<xsl:template match="image">
<img id="{@title}"/>
</xsl:template>
</xsl:stylesheet>