< !-- Emp.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="Emp.css"?>
<?xml-stylesheet type="text/xsl" href="Emp.xsl"?>
<entreprise>
<employes>
<employe id="00001">
<nom>Ahbouz</nom>
<service>Informatique</service>
</employe>
<employe id="00002">
<nom>Mouzone</nom>
<service>Gestion</service>
</employe>
<employe id="00003">
<nom>Sbabou</nom>
<service>Reseau</service>
</employe>
<employe id="00004">
<nom>khoulani</nom>
<service>Industrie</service>
</employe>
</employes>
</entreprise>
< !—Emp.xsl -- >
< !—Version : 01 -- >
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<xsl:output method="html" encoding="UTF-8" />
<xsl:template match="/">
<html>
<head><title>Liste de personnes</title></head>
<link rel="stylesheet" href="Emp.css"/>
<body>
<table>
<tr><th>N° Employe </th><th>Nom</th><th>Service</th></tr>
<!-- Appel récursif -->
<xsl:apply-templates select="//employe">
<xsl:sort order="descending" select="nom"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<!-- Def des appel récursif -->
<xsl:template match="//employe">
<tr>
<td><xsl:value-of select="./@id"/></td>
<td><xsl:value-of select="./nom"/></td>
<td><xsl:value-of select="./service"/></td>
</tr>
</xsl:template>
</xsl:stylesheet>
< !—Emp.css -- >
table,th,td {
border:1px solid black;
} table {
border-collapse:collapse;
}
tr:nth-child(2n) > td
{
background-color:yellow;
}
tr:nth-child(2n+1) > td
{
background-color:lime;
}
< !—Emp.xsl -- >
< !—Version : 02 -- >
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<xsl:output method="html" encoding="UTF-8" />
<xsl:template match="/">
<html>
<head><title>Liste de personnes</title></head>
<link rel="stylesheet" href="tdi.css"/>
<body>
<table>
<tr><th>N° Employe </th><th>Nom</th><th>Service</th></tr>
<xsl:for-each select="//employe[service=’Informatique’ or service=’Reseau’] ">
<xsl:sort order="descending" select="nom"/>
<tr>
<td><xsl:value-of select="./@id"/></td>
<td><xsl:value-of select="./nom"/></td>
<td><xsl:value-of select="./service"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
< !—Emp.xsl -- >
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<xsl:output method="html" encoding="UTF-8" />
<xsl:template match="/">
<html>
<head><title>Liste de personnes</title></head>
<link rel="stylesheet" href="tdi.css"/>
<body>
<table>
<tr><th>N° Employe </th><th>Nom</th><th>Service</th></tr>
<xsl:for-each select="//employe">
<xsl:sort order="descending" select="nom"/>
<xsl:if test="./service='Informatique'">
<tr>
<td><xsl:value-of select="./@id"/></td>
<td><xsl:value-of select="./nom"/></td>
<td><xsl:value-of select="./service"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Ajouter un commentaire
Veuillez vous connecter pour ajouter un commentaire.
Pas encore de commentaires.