2009-09-03 6 views
1

XSLTProcessor :: hasExsltSupport() renvoie la valeur true. Maintenant, que dois-je modifier pour pouvoir l'utiliser?Comment utiliser EXSLT intégré à partir de XSLTProcessor?

Je

<xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:date="http://exslt.org/dates-and-times" 
       extension-element-prefixes="date"> 

Transformation ce que je suis en train de faire:

<td> 
    <xsl:value-of select="date:format-date(translate(property[@name='changedate']/value, ' ', 'T'), 'd.m.y h:i')" /> 
</td> 
  • propriété [@ name = 'CHANGEDATE']/valeur est tampon de SQL DB (AAAA mm-jj hh: mm: ss)
  • Remplacez d'abord cet espace par T afin que exslt date-format understands it
  • Modifier * aaaa-mm-jj *** T *** hh: mm: ss * -> jj.mm.aaaa hh: mm

Erreur:

Attention: XSLTProcessor :: transformToXML() [xsltprocessor.transformtoxml]: xmlXPathCompOpEval: Date de fonction lié au format préfixe non défini

version PHP 5.2.9

  • permis
  • XSL
  • libxslt Version 1.1.24
  • libxslt compilé contre libxml Version 2.6.32
  • EXSLT activé
  • libexslt Version 1.1.24
+0

Et votre sortie/résultat/erreur actuelle est? – Tomalak

Répondre

1

je fixe avec cette Il informations à jour se déplace pour corriger les positions

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:template name="FormatDate"> 
    <xsl:param name="DateTime" /> 

    <xsl:variable name="mo"> 
     <xsl:value-of select="substring($DateTime, 6, 2)" /> 
    </xsl:variable> 

    <xsl:variable name="day"> 
     <xsl:value-of select="substring($DateTime, 9, 2)" /> 
    </xsl:variable> 

    <xsl:variable name="year"> 
     <xsl:value-of select="substring($DateTime, 1, 4)" /> 
    </xsl:variable> 

    <xsl:variable name="time"> 
     <xsl:value-of select="substring($DateTime, 12, 8)" /> 
    </xsl:variable> 

    <xsl:variable name="hh"> 
     <xsl:value-of select="substring($time, 1, 2)" /> 
    </xsl:variable> 

    <xsl:variable name="mm"> 
     <xsl:value-of select="substring($time, 4, 2)" /> 
    </xsl:variable> 

    <xsl:value-of select="$day" /> 
    <xsl:value-of select="'.'" /> 
    <xsl:value-of select="$mo" /> 
    <xsl:value-of select="'.'" /> 
    <xsl:value-of select="$year" /> 

    <xsl:value-of select="' '" /> 

    <xsl:value-of select="$hh" /> 
    <xsl:value-of select="':'" /> 
    <xsl:value-of select="$mm" /> 

    </xsl:template> 
</xsl:stylesheet> 
0

« Les fonctions d'extension suivantes ne sont pas considérés comme stables et ne font pas partie du noyau de EXSLT - Dates et heures . Processeurs qui prétendent appuyer EXSLT -. Dates et temps pourrait ne pas remplir ces fonctions » -... Cela vaut pour format-date ainsi

+0

format-date(): http://exslt.org/date/functions/format-date/index.html – raspi

+0

Yup, l'a manqué. –

Questions connexes