Bonjour alors voilà mon problème un XSL me permet de générer un tableau à partir d'un fichier XML
le tableau obtenu est de la forme suivante :
Code Article Désignation Quantité
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 9
VT-CS-HPUX CS for HP-UX 2
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 3
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 5
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 1
VT-CS-HPUX CS for HP-UX 1
VT-CS-ILIN CS for Intel LINUX 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 3
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 3
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 1
VT-CS-WNT CS for Windows NT/2000 2
VT-CS-WNT CS for Windows NT/2000 4
VT-CS-WNT CS for Windows NT/2000 2
VT-SDS-HPUX SDS for HP-UX 1
VT-SDS-HPUX SDS for HP-UX 1
VT-SDS-HPUX SDS for HP-UX 1
VT-XVI-HPUX XVI for HP-UX 1
VT-XVI-WNT XVI for Windows NT 1
VT-XVI-WNT XVI for Windows NT 1
Voila le XSL correspondant
Code :
Code :
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output encoding="ISO-8859-1" method="html"/>
- <xsl:param name="entreprise" />
- <xsl:param name="site" />
- <xsl:template match="Synthese">
- <table width="100%" border="0" cellspacing="2" cellpadding="0">
- <tr style="background-color:#e8e8e8" >
- <td width="33%"><b>Code Article</b></td>
- <td width="33%"><b>Désignation</b></td>
- <td width="33%"><b>Quantité </b></td>
- </tr>
- </table>
- <table width="100%" border="1" bordercolor="#e8e8e8" cellspacing="0" cellpadding="0">
- <xsl:for-each select="Record">
- <xsl:choose>
- <xsl:when test="./CpyTrdNamDsc=$entreprise and ./CpyAddrExCde=$site">
- <tr>
- <td width="25%"><xsl:value-of select="ObjExCde"/></td>
- <td width="25%"><xsl:value-of select="ObjDsc"/></td>
- <td width="25%"><xsl:value-of select="DosQtyVal"/></td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </table>
- </xsl:template>
- </xsl:stylesheet>
|
et un bout du XML
Code :
Code :
- <Record>
- <CpyTrdNamDsc><![CDATA[SANOFI WINTHROP INDUSTRIE]]></CpyTrdNamDsc>
- <CpyAddrExCde><![CDATA[QUETIGNY]]></CpyAddrExCde>
- <ObjExCde><![CDATA[VT-CS-HPUX]]></ObjExCde>
- <ObjDsc><![CDATA[CS for HP-UX]]></ObjDsc>
- <DosQtyVal>2</DosQtyVal>
- <CntExCde><![CDATA[050701.01]]></CntExCde>
- <CpyInCde>1318</CpyInCde>
- </Record>
- <Record>
- <CpyTrdNamDsc><![CDATA[SANOFI WINTHROP INDUSTRIE]]></CpyTrdNamDsc>
- <CpyAddrExCde><![CDATA[AMBARES]]></CpyAddrExCde>
- <ObjExCde><![CDATA[VT-CS-HPUX]]></ObjExCde>
- <ObjDsc><![CDATA[CS for HP-UX]]></ObjDsc>
- <DosQtyVal>1</DosQtyVal>
- <CntExCde><![CDATA[Crt SHRR080728.01+Avt n°1]]></CntExCde>
- <CpyInCde>1318</CpyInCde>
- </Record>
- <Record>
- <CpyTrdNamDsc><![CDATA[SANOFI WINTHROP INDUSTRIE]]></CpyTrdNamDsc>
- <CpyAddrExCde><![CDATA[AMBARES]]></CpyAddrExCde>
- <ObjExCde><![CDATA[VT-CS-HPUX]]></ObjExCde>
- <ObjDsc><![CDATA[CS for HP-UX]]></ObjDsc>
- <DosQtyVal>9</DosQtyVal>
- <CntExCde><![CDATA[Crt SHRR080728.01+Avt n°1]]></CntExCde>
- <CpyInCde>1318</CpyInCde>
- </Record>
- <Record>
- <CpyTrdNamDsc><![CDATA[SANOFI WINTHROP INDUSTRIE]]></CpyTrdNamDsc>
- <CpyAddrExCde><![CDATA[CHILLY MAZARIN]]></CpyAddrExCde>
- <ObjExCde><![CDATA[VT-CS-HPUX]]></ObjExCde>
- <ObjDsc><![CDATA[CS for HP-UX]]></ObjDsc>
- <DosQtyVal>1</DosQtyVal>
- <CntExCde><![CDATA[050601.03]]></CntExCde>
- <CpyInCde>1318</CpyInCde>
- </Record>
- <Record>
- <CpyTrdNamDsc><![CDATA[SANOFI WINTHROP INDUSTRIE]]></CpyTrdNamDsc>
- <CpyAddrExCde><![CDATA[MONTARGIS2]]></CpyAddrExCde>
- <ObjExCde><![CDATA[VT-CS-HPUX]]></ObjExCde>
- <ObjDsc><![CDATA[CS for HP-UX]]></ObjDsc>
- <DosQtyVal>2</DosQtyVal>
- <CntExCde><![CDATA[PC.SH070327.01(crt n°SHRR060427.01)]]></CntExCde>
- <CpyInCde>1318</CpyInCde>
|
Mon but étant d'ajouter une 4ème colonne pour sommer les quantité de licence en fonction du code article.
J'ai bien essayer un
Code :
Code :
- <td width="25%"><xsl:value-of select="sum(preceding::DosQtyVal[../ObjExCde=current()/ObjExCde]|DosQtyVal)"/></td>
|
mais avec le <xsl:for-each select="Record"> ca marche pas bien du tout la somme récursive
Quelqu'un aurait une idée ?