1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xchngr="image-etc.com/Exchanger" version="1.0">
<xsl:output method="xml" version="1.0" encoding="windows-1252"/>
<msxsl:script language="JScript" implements-prefix="xchngr">
<![CDATA[
function date()
{
var myDate = new Date();
return(myDate.getDate() + "/" + (myDate.getMonth()+1) + "/" + myDate.getYear() + " " + myDate.getHours() + ":" + myDate.getMinutes() + ":" + myDate.getSeconds() +
":" + myDate.getMilliseconds());
}
function date_fichier(strin)
{
var myDate = new Date(strin.substr(0,4), strin.substr(5,2), strin.substr(8,2), strin.substr(11,2), strin.substr(14,2), strin.substr(17,2))
return(myDate.getDate() + "/" + myDate.getMonth() + "/" + myDate.getYear() + " " + myDate.getHours() + ":" + myDate.getMinutes() + ":" + myDate.getSeconds() +
":" + myDate.getMilliseconds());
}
function diffdate(strin,u)
{
var d1 = new Date();
d1.setMonth(d1.getMonth()+1);
var d2 = new Date(strin.substr(0,4), strin.substr(5,2), strin.substr(8,2), strin.substr(11,2), strin.substr(14,2), strin.substr(17,2));
var div=1;
switch(u){
case 's':
div=1000;
break;
case 'm':
div=1000*60;
break;
case 'h':
div=1000*60*60;
break;
case 'd':
div=1000*60*60*24;
break;
}
var Diff = d1.getTime() - d2.getTime();
//test si le fichier date de moins de 12 heures
if( Math.ceil(Diff/div)<12)
{
return('OK');
}
else
{
return('NOK');
}
;
}
]]>
</msxsl:script>
<xsl:param name="xchngr:ref"/>
<xsl:template match="/">
<xsl:element name="Rapport_test_fichier">
<!--<xsl:variable name="compteur" select="count(document('C:\temp\New_export\conf\temp\liste_pdf1.xml')//Rapport_liste_pdf/LISTES/PDF[string(.)='NOK'])"></xsl:variable>-->
<!--<xsl:value-of select="xchngr:compter(document('C:\temp\New_export\conf\temp\liste_pdf1.xml')//Rapport_liste_pdf/@COMPTEUR/text())"/>-->
<xsl:variable name="date_jour" select="xchngr:date()"></xsl:variable>
<xsl:element name="Fichier">
<xsl:for-each select="//file">
<xsl:attribute name="date_fichier"><xsl:value-of select="xchngr:date_fichier(string(@date))"/></xsl:attribute>
<xsl:attribute name="taille_fichier"><xsl:value-of select="string(@size)"/></xsl:attribute>
<xsl:attribute name="nom_fichier"><xsl:value-of select="concat(/list/text(),'\',/list/file/text())"/></xsl:attribute>
<!-- test si le fichier Ã* moins de 12heures si oui OK si non NOK -->
<xsl:attribute name="test_date_valide"><xsl:value-of select="xchngr:diffdate(string(@date),'h')"/></xsl:attribute>
<!--<xsl:element name="PDF">
<xsl:attribute name="NOM"><xsl:value-of select="@NOM"/></xsl:attribute>
<xsl:choose>
<xsl:when test="document('C:\temp\New_export\conf\temp\liste_pdf.xml')//file[contains(text(),concat($page,'.PDF'))]">OK</xsl:when>
<xsl:when test="document('C:\temp\New_export\conf\temp\liste_pdf.xml')//file[contains(text(),concat($page,'.pdf'))]">OK</xsl:when>
<xsl:otherwise>NOK</xsl:otherwise>
</xsl:choose>
</xsl:element>-->
</xsl:for-each>
</xsl:element>
<xsl:element name="Date_heure_local">
<xsl:value-of select="$date_jour"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet> |
Partager