Re: Format date EXSLT

Stephane Bortzmeyer <[email protected]>
Newsgroups gmane.text.xml.french.tech
Message-ID <[email protected]>
On Thu, May 18, 2006 at 05:02:24PM +0200,
 IGP04Bozghiba Imed <[email protected]> wrote 
 a message of 80 lines which said:

>               xmlns:xsl="http://www.w3.org/1999/XSL/Transform <http://www.w3.org/1999/XSL/Transform> "

Il y a déjà une première erreur ici, cela devrait être :

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

sans l'URL entre < et >. Je m'étonne même que votre processeur l'aie
accepté, ce n'est pas du XML bien formé.

>         <xsl:template name="personne">

Ici, vous créez un "template" nommé "personne" mais il n'est jamais
appelé.

Ce code marche pour moi (j'appelle date:format-date depuis le
"template" qui gère les éléments <personne>).

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

  <!-- Teste avec xsltproc et 4xslt mais aucun des deux n'a EXSLT
  date: en natif -->
  <xsl:include href="date.format-date.template.xsl"/>    

  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  
  <xsl:template match="carnet">
    <xsl:apply-templates select="personne">
      <xsl:sort order="descending" select="date"/>
    </xsl:apply-templates>
  </xsl:template>
  
  <xsl:template match="personne">
    <xsl:value-of select="nom"/><xsl:text> </xsl:text>
    <xsl:call-template name="date:format-date">
      <xsl:with-param name="date-time" select="date" />
      <xsl:with-param name="pattern" select="'dd MMMM yyyy'" />
    </xsl:call-template>
    <xsl:text>
    </xsl:text>
  </xsl:template>
  
</xsl:stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.