[xsl] how can I rewrite it so I have a variable for year

Subject: [xsl] how can I rewrite it so I have a variable for year
From: Roelof Wobben <rwobben@xxxxxxxxxxx>
Date: Fri, 6 Jan 2012 19:15:29 +0000
Hello,



I have this xslt :



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>


<xsl:import href="../utilities/date-time.xsl"/>



<xsl:template match="data/menu">
  <div id="firstpane" class="menu_list">
     <xsl:apply-templates select="year" />
 </div>
</xsl:template>

<xsl:template match="year">
 <p class="menu_head"> <xsl:value-of select="@value"/>  </p>
  <div class="menu_body">
      <xsl:apply-templates select="month" />
 </div>
</xsl:template>

<xsl:template match="month">
 <a href="{$root}/dagboek/2005/{@value}/1" >
  <xsl:call-template name="format-date">
 <xsl:with-param name="date" select="concat('2222','-',@value,'-01')"/>
 <xsl:with-param name="format" select="'M'"/>
  </xsl:call-template>
</a>
</xsl:template>

</xsl:stylesheet>





the relevant xml can be found here :



<data>

  <menu>

      <section id="9" handle="dagboek">Dagboek</section>

      <year value="2005">

      <month value="02">

         <entry id="14" />

         <entry id="15" />

         <entry id="16" />

      </month>

      <month value="03">

          <entry id="17" />

      </month>

      </year>

</menu>







But as you can see the year must be hardcoded because I can use for example
@value or $year.



Can anyone give me a tip how I can rewrite this part so I can use some sort of
variable for year ?



Roelof

Current Thread