xsl-list
[Top] [All Lists]

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

2012-01-06 13:15:43


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

                                          
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>