[XSLT] xsl:import ou xsl:include
Salut,
Soit le fichier XSL suivant, pour lequel je veux externaliser la partie en rouge dans un autre XSL... comment dois-je procéder ?
Code:
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
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<!-- Parametres d entrees -->
<xsl:param name="champTri"/>
<xsl:param name="sensTri"/>
<xsl:param name="nbEnregPage"/>
<xsl:param name="enregDeb"/>
<xsl:template match="root">
<table>
<xsl:variable name="newSensTri">
<xsl:if test="$sensTri='ascending'">descending</xsl:if>
<xsl:if test="$sensTri='descending'">ascending</xsl:if>
</xsl:variable>
<!-- Entete -->
<tr>
<th><a href="javascript:tri('reference','{$newSensTri}')">Reference</a></th>
<th><a href="javascript:tri('libelle','{$newSensTri}')">Libelle</a></th>
<th><a href="javascript:tri('telephone','{$newSensTri}')">Telephone</a></th>
<th><a href="javascript:tri('count(intervenant)','{$newSensTri}')">Nb. Interv.</a></th>
<th>Nom</th>
<th>Adresse</th>
</tr>
<xsl:for-each select="structure[position() > 0 and position() < 10]">
<xsl:sort select="*[name()=$champTri]" order="{$sensTri}"/>
<tr>
<!-- Colorer une ligne sur 2 -->
<xsl:if test="(position() mod 2)=0">
<xsl:attribute name="bgcolor">grey</xsl:attribute>
</xsl:if>
<xsl:if test="count(intervenant) > 1">
<xsl:attribute name="rowspan">2</xsl:attribute>
<xsl:attribute name="valign">top</xsl:attribute>
</xsl:if>
<td><xsl:value-of select="reference"/></td>
<td><xsl:value-of select="libelle"/></td>
<td><xsl:value-of select="telephone"/></td>
<td><xsl:value-of select="count(intervenant)"/></td>
<!-- Rupture sur intervenant -->
<xsl:if test="count(intervenant) > 1">
<td>
<table>
<xsl:for-each select="intervenant">
<tr>
<td>
<xsl:value-of select="concat(nom, '-', prenom)"/>
</td>
</tr>
</xsl:for-each>
</table>
</td>
</xsl:if>
<xsl:if test="count(intervenant) < 1">
<td></td>
</xsl:if>
<td><xsl:value-of select="adresse"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet> |
Merci.