Search

Hello,

Here's the relevant part of my xml.

<data>
      <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>

and here's my xslt for the month part:

<?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="#"> 
  <xsl:call-template name="format-date">
    <xsl:with-param name="date" select="month"/>
    <xsl:with-param name="format" select="'M'"/>
  </xsl:call-template>
</a> <br />
</xsl:template>

</xsl:stylesheet>

Now I wonder what I have to fill in on select. I tried @value, month, mont/value but without any sucess.

I guess you mean the <xsl:with-param name="date" select="month"/> part, right?

That thing is called the Format Date/Time Utility and expects a string like YYYY-MM-DD. So in your case you would have to prepend a dummy year and append a dummy day to @value, i.e. using the concat() method.

So it will be <xsl:value-of-select="concat('2222','-',@value,'-01')"

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details