<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  

  <xsl:template match="yset">
    <set>
      <xsl:apply-templates/>
    </set>
  </xsl:template>

  <xsl:template match="year">
    <xsl:variable name="y" select="."/>
    <xsl:for-each select="document(concat($y, '.data'))//serie//title">
      <xsl:variable name="i" select="ancestor::issue/@nr"/>
      
      <serie>
        <xsl:attribute name="i">
          <xsl:value-of select="$y"/>
          <xsl:text>-</xsl:text>
          <xsl:if test="string-length($i) &lt; 2">
            <xsl:text>0</xsl:text>
          </xsl:if>
          <xsl:value-of select="$i"/>
        </xsl:attribute>
        <xsl:value-of select="."/>
      </serie>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

