Bonjour à Tous,
Je viens de m'inscrire car je cherche quelques réponse en codage XSL.
Voilà, je débute en XSL et j'ai un souci d'affiche d'image.
C'est des annonces de voitures et j'aimerais n'afficher que celle qui comporte que des images et uniquement celle commençant par _PHOTO/_0
Pourriez vous me donner un ptit coup de main sur ce problème.
Merci à vous.
Mon code XSL :
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 <?xml version="1.0" encoding="ISO-8859-15"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="xhtml"> <xsl:output method="xml" encoding="iso-8859-1" omit-xml-declaration="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" /> <xsl:template match="/module/content/_result/_data"> <xsl:apply-templates select="*[_PRICE > 4999 and _PRICE < 20001]/_BRAND"/> </xsl:template> <xsl:template match="_BRAND"> <xsl:variable name="lien"> <xsl:text>http://logp.xiti.com/go.ad?xts=</xsl:text> <xsl:text>##f##</xsl:text> <!-- xitisiteid --> <xsl:text>&atc=PUB-[D_</xsl:text> <xsl:text>##a##</xsl:text> <!-- campagneid --> <xsl:text>]-[</xsl:text> <xsl:text>##d##</xsl:text> <!-- templateid --> <xsl:text>]-[</xsl:text> <xsl:text>##b##</xsl:text> <!-- variantid --> <xsl:text>]-[</xsl:text> <xsl:text>##e##</xsl:text> <!-- encartid --> <xsl:text>]---[D_</xsl:text> <xsl:text>##c##</xsl:text> <!-- partenaireid --> <xsl:text>]-&type=AT&url=</xsl:text> <xsl:value-of select="../_URL"/> </xsl:variable> <xsl:if test="position() < 2"> <div class="bloc_content"> <div class="bloc_partenaire_1img"> <a target="_blank"> <xsl:attribute name="href"><xsl:value-of select="$lien" /></xsl:attribute> <img width="300"> <xsl:attribute name="src"><xsl:value-of select="../_PHOTO/_0"/></xsl:attribute> <xsl:attribute name="alt"><xsl:value-of select="../_MODEL"/></xsl:attribute> </img> </a> <p class="button button_dark"> <a class="simple_arrow" target="_blank"> <xsl:attribute name="href"><xsl:value-of select="$lien" /></xsl:attribute> <xsl:text>Voir l'annonce</xsl:text> </a> </p> <div class="item_title"> <a target="_blank"> <xsl:attribute name="href"><xsl:value-of select="$lien" /></xsl:attribute> <xsl:value-of select="../_BRAND"/>*<xsl:value-of select="../_MODEL"/> </a> </div> <p>Prix : <xsl:value-of select="../_PRICE"/> </p> <p>Département : <xsl:value-of select="../_VISITPLACE"/></p> </div> </div> </xsl:if> </xsl:template> </xsl:stylesheet>
et mon code XML :
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 <?xml version="1.0" encoding="ISO-8859-15"?> <module id="2933"> <content appearance="" appearance_slug=""> <_result> <_erreur> </_erreur> <_data> <_0> <_BRAND>VOLKSWAGEN</_BRAND> <_MODEL>GOLF</_MODEL> <_VERSION>VI 20 TDI 110 FAP CR CARAT 5P</_VERSION> <_PRICE>13900</_PRICE> <_VISITPLACE>02</_VISITPLACE> <_URL>http://www.lacentrale.fr/auto-occasion-annonce-19433535.html</_URL> <_PHOTO/> </_0> <_1> <_BRAND>MAZDA</_BRAND> <_MODEL>5</_MODEL> <_VERSION>20 MZR-CD 110 ELEGANCE 7PL</_VERSION> <_PRICE>9390</_PRICE> <_VISITPLACE>28</_VISITPLACE> <_URL>http://www.lacentrale.fr/auto-occasion-annonce-19384997.html</_URL> <_PHOTO> <_0>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508.jpg</_0> <_1>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_1.jpg</_1> <_2>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_2.jpg</_2> <_3>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_3.jpg</_3> <_4>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_4.jpg</_4> <_5>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_5.jpg</_5> <_6>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_6.jpg</_6> <_7>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_7.jpg</_7> <_8>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_8.jpg</_8> <_9>http://photo.lacentrale.fr/photo/lc/E1/06/51/E10651508_9.jpg</_9> </_PHOTO> </_1> <_2> <_BRAND>PEUGEOT</_BRAND> <_MODEL>107</_MODEL> <_VERSION>2 10 TRENDY 5P</_VERSION> <_PRICE>6990</_PRICE> <_VISITPLACE>14</_VISITPLACE> <_URL>http://www.lacentrale.fr/auto-occasion-annonce-19425713.html</_URL> <_PHOTO> <_0>http://photo.lacentrale.fr/photo/lc/E1/06/79/E10679125.jpg</_0> <_1>http://photo.lacentrale.fr/photo/lc/E1/06/79/E10679125_1.jpg</_1> <_2>http://photo.lacentrale.fr/photo/lc/E1/06/79/E10679125_2.jpg</_2> <_3>http://photo.lacentrale.fr/photo/lc/E1/06/79/E10679125_3.jpg</_3> <_4>http://photo.lacentrale.fr/photo/lc/E1/06/79/E10679125_4.jpg</_4> </_PHOTO> </_2> <_3> <_BRAND>AUDI</_BRAND> <_MODEL>S6</_MODEL> <_VERSION>III 52 V10 435 QUATTRO TIPTRONIC</_VERSION> <_PRICE>33490</_PRICE> <_VISITPLACE>77</_VISITPLACE> <_URL>http://www.lacentrale.fr/auto-occasion-annonce-18864939.html</_URL> <_PHOTO> <_0>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671.jpg</_0> <_1>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_1.jpg</_1> <_2>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_2.jpg</_2> <_3>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_3.jpg</_3> <_4>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_4.jpg</_4> <_5>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_5.jpg</_5> <_6>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_6.jpg</_6> <_7>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_7.jpg</_7> <_8>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_8.jpg</_8> <_9>http://photo.lacentrale.fr/photo/lc/W1/02/93/W10293671_9.jpg</_9> </_PHOTO> </_3> </_data> </_result> </content> </module>
Partager