EDIT:petite optimisation de place mémoire
<xsl:with-param name="noeud" select="$noeud[position() < (($M*$C)+1)]"/>
[position() < (($M*$C)+1)] ajoute pour diminuer la taille du node-set
autre version
pas copie sur le vieux shnock promis
)
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
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="M" select="3"/>
<xsl:variable name="C" select="4"/>
<xsl:template match="/">
<html>
<head>
<title/>
</head>
<body>
<table>
<tbody>
<xsl:call-template name="ligne">
<xsl:with-param name="noeud" select="//fichier"/>
</xsl:call-template>
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template name="ligne">
<xsl:param name="noeud"/>
<tr>
<xsl:call-template name="cellule">
<xsl:with-param name="noeud" select="$noeud[position() < (($M*$C)+1)]"/>
<xsl:with-param name="nb_colonne" select="$C"/>
</xsl:call-template>
</tr>
<xsl:if test="$noeud[position() > ($M*$C)]">
<xsl:call-template name="ligne">
<xsl:with-param name="noeud" select="$noeud[position() > ($M*$C)]"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="cellule">
<xsl:param name="noeud"/>
<xsl:param name="nb_colonne"/>
<td>
<xsl:for-each select="$noeud[position() <($M + 1)]">
<xsl:value-of select="concat(@nom,';')"/>
</xsl:for-each>
</td>
<xsl:if test="$noeud[(position() > $M) and ($nb_colonne > 1)]">
<xsl:call-template name="cellule">
<xsl:with-param name="noeud" select="$noeud[position() > $M]"/>
<xsl:with-param name="nb_colonne" select="$nb_colonne - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet> |
Partager