[XSLT] Transformé une valeur pour la sortie (xs:duration)

Transformé une valeur pour la sortie (xs:duration) [XSLT] - XML/XSL - Programmation

Marsh Posté le 10-05-2003 à 23:13:34    

Salut
 
Comment faut-il faire pour transformer un élément pour l'affichage en html avec un document xslt.
 
Par exemple, j'ai des éléments de type xs:duration, quand je veux les afficher, cela donner des trucs du genre PT5M47S. Comment puis-je faire pour afficher quelque chose comme ceci : 5 min 47 s ???
 
Merci

Reply

Marsh Posté le 10-05-2003 à 23:13:34   

Reply

Marsh Posté le 11-05-2003 à 14:56:07    

vas voir du coté de exslt: date:format-date  
http://www.exslt.org/date/function [...] index.html
 

Citation :

Implementer Page: date.format-date.html
Function Package: date.format-date.zip
 
Function Syntax
string date:format-date(string, string)
Template Syntax
<xsl:call-template name="date:format-date">
   <xsl:with-param name="date-time" select="string" />
   <xsl:with-param name="pattern" select="string" />
</xsl:call-template>
The date:format-date function formats a date/time according to a pattern.  
 
The first argument to date:format-date specifies the date/time to be formatted. It must be right or left-truncated date/time strings in one of the formats defined in [XML Schema Part 2: Datatypes]. The permitted formats are as follows:  
 
xs:dateTime (CCYY-MM-DDThh:mm:ss)  
xs:date (CCYY-MM-DD)  
xs:time (hh:mm:ss)  
xs:gYearMonth (CCYY-MM)  
xs:gYear (CCYY)  
xs:gMonthDay (--MM-DD)  
xs:gMonth (--MM--)  
xs:gDay (---DD)  
The second argument is a string that gives the format pattern used to format the date. The format pattern must be in the syntax specified by the JDK 1.1 SimpleDateFormat class. The format pattern string is interpreted as described for the JDK 1.1 SimpleDateFormat class.  
 
If the date/time format is right-truncated (i.e. in a format other than xs:time, or xs:dateTime) then any missing components are assumed to be as follows: if no month is specified, it is given a month of 01; if no day is specified, it is given a day of 01; if no time is specified, it is given a time of 00:00:00.  
 
If the date/time format is left-truncated (i.e. xs:time, xs:gMonthDay, xs:gMonth or xs:gDay) and the format pattern has a token that uses a component that is missing from the date/time format used, then that token is replaced with an empty string ('';) within the result.  
 
ImplementationsThere are currently no XSLT processors that we know of that support date:format-date natively.
 
Implementations of date:format-date are available in the following languages:  
 
Javascript (by Chris Bayes)
Msxsl (by Chris Bayes)
EXSLT Function (by Jeni Tennison)
XSLT Template (by Jeni Tennison)


 
A+,


---------------
There's more than what can be linked! --    Iyashikei Anime Forever!    --  AngularJS c'est un framework d'engulé!  --
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed