Bonjour à tous,
J'ai un problème d'affichage sur une valeur en particulier.
Je souhaite transformer ma feuille XML (présente dans une session php) via xsl pour affichage
Toutes les valeurs s'affichent correctement sauf 1, la liste des produits
Voici le fichier XML simplifié au maximum :
Ce fichier appelle donc un fichier xslt (result_en.xslt) dont voici le source
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 <?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="result_en.xslt"?> <Clients> <Client> <Name>Nom</Name> <Street>Rue</Street> <ZipCode>Code postal</ZipCode> <City>Ville</City> <Country>Pays</Country> <HasSecondarySite>1</HasSecondarySite> <ActivityDomain> <ActivityDomainName>Domaine</ActivityDomainName> </ActivityDomain> <Service> <ServiceName>nom du service</ServiceName> </Service> <Prod> <pr>Produit 1</pr> <pr>Produit 2</pr> </Prod> </Client> </Clients>
Le problème vient donc de la ligne suivante :
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92 <?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" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <html> <head> </head> <body> <table> <tr> <td>Name</td> <td>Address</td> <td>Activity domain</td> <td>service</td> <td>Product Category</td> <td>Sites</td> <td>doc</td> </tr> <xsl:for-each select="//Client "> <tr> <xsl:choose> <xsl:when test="(position() mod 2) = 0"> <xsl:attribute name="bgcolor">#ECE9D8</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="bgcolor">#FFFFFF</xsl:attribute> </xsl:otherwise> </xsl:choose> <td> <xsl:value-of select="Name"/> </td> <td> <xsl:value-of select="Street"/> <xsl:text> </xsl:text> <xsl:value-of select="ZipCode"/> <xsl:text> </xsl:text> <xsl:value-of select="City"/> </td> <td> <xsl:value-of select="ActivityDomain/ActivityDomainName"/> </td> <td> <xsl:for-each select="Service "> <xsl:choose> <xsl:when test="substring(ServiceName,0, 3) = 'test1'"> <xsl:value-of select="ServiceName"/> </xsl:when> <xsl:when test="substring(ServiceName,0, 4) = 'test2'"> <xsl:value-of select="ServiceName"/> <br></br> </xsl:when> </xsl:choose> <br></br> </xsl:for-each> </td> <td> <xsl:for-each select="Prod/pr"> <xsl:value-of select="."/> </xsl:for-each> </td> <xsl:if test="HasSecondarySite= '0' "> <td>No</td> </xsl:if> <xsl:if test="HasSecondarySite= '1' "> <td>Yes</td> </xsl:if> <td> <a href=""> <xsl:text>Document</xsl:text> </a> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
J'ai essayé select"current()", j'ai aussi essayé select=".", rien à faire....
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 <xsl:for-each select="Prod/pr"> <xsl:value-of select="."/> </xsl:for-each>
Partager