Re,
Je reviens une fois encore car j'ai un autre souci. J'aimerai afficher seulement les informations d'un seul étudiant.
Comme j'ai mis mes requêtes dans la boucle for-each, il m'affiche les infos pour tous les étudiants. Hors si j'enlève la boucle je n'aurais pas les données qui sont dans la fonction "xsl: choose".
Voilà mon code xsl:
J'ai besoin de l'aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?xml version="1.0" encoding="UTF-8"?> <!-- New XSLT document created with EditiX XML Editor (http://www.editix.com) at Mon Mar 02 16:16:29 CET 2015 --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <meta charset="utf-8"/> <title>Profil d'un étudiant</title> </head> <body style="background-color:#d0caca; width:100%"> <h1>Profil d'un ancien étudiant</h1> <h2 style="background-color:#406e90; color:#fff; width:260px">Profil d'un étudiant:</h2> <div style="display:inline-block; vertical-align: top" > <img src="Avatar.png" width="100" height="100" alt="Avatar d'un étudiant" /> </div> <div style="display:inline-block"> <xsl:for-each select="carnetDadresse/alumni/alumnus"> <strong>Prénom : </strong><span><xsl:value-of select="prenom"/></span> <br/> <strong>Nom : </strong><span><xsl:value-of select="nom"/></span><br/> <strong>Date de naissance : </strong><span><xsl:value-of select="date_naissance"/></span><br/> <span> <xsl:variable name="alumnus" select="@fk_id_adresse"/> <xsl:choose> <xsl:when test="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]"> <strong>Adresse : </strong><xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/numero"/> <xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/rue"/><br/> <xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/code_postal"/> <xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/ville"/><br/> <strong>Téléphone : </strong><span style="color:#1510a2;"><xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/telephone"/></span><br/> <strong>Email : </strong><span style="color:#1510a2;"><xsl:value-of select="/carnetDadresse/adresses/adresse[@pk_id_adresse = $alumnus]/email"/></span> </xsl:when> <xsl:otherwise> <xsl:value-of select="' '" /> </xsl:otherwise> </xsl:choose> </span><br/> <span> <xsl:variable name="alumnus" select="@fk_id_entreprise"/> <xsl:choose> <xsl:when test="/carnetDadresse/entreprises/entreprise[@pk_id_entreprise = $alumnus]"> <strong>Nom de l'entreprise : </strong><xsl:value-of select="/carnetDadresse/entreprises/entreprise[@pk_id_entreprise = $alumnus]/nom_entreprise"/><br/> <strong>Fonction : </strong><xsl:value-of select="/carnetDadresse/entreprises/entreprise[@pk_id_entreprise = $alumnus]/fonction"/><br/> <strong>Date d'entrée : </strong><xsl:value-of select="/carnetDadresse/entreprises/entreprise[@pk_id_entreprise = $alumnus]/date_entree"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="' '"/> </xsl:otherwise> </xsl:choose> </span><br/> </xsl:for-each> </div> </body> </html> </xsl:template> </xsl:stylesheet>
Merci encore!
Partager