[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

how can I rewrite it so I have a variable for year

Subject: 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
 how can I rewrite it so I have a variable for year
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.