Bonjour à tous,
Je début en Xsl,et voici mon problème je cherche à faire un trie sur des éléments. j'y suis arrivé mais il triplé les infos, et là, il ne tripe pas les info mais il ne les trie plus.
Voici mes code merci à vous.
Pour info : je suis dyslexique et dysorthographie, je fais un max.
mon code xslt :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 <?xml version="1.0" encoding="UTF-8"?> <Products> <product> <ISBN>9781234567891</ISBN> <title>zzzzzzzzzzz</title> <date>2015-10-23</date> <serial_info> <code>VR33</code> </serial_info> </product> <product> <ISBN>9782345678912</ISBN> <title>Xxxxxxxxxx xxxxx</title> <date>2017-10-03</date> <serial_info> <code>VR32</code> </serial_info> </product> <product> <ISBN>9783456789123</ISBN> <title>Wwwww</title> <date>2016-04-28</date> <serial_info> <code>VR33</code> </serial_info> </product> <serial> <code>VR33</code> <title>Eeeee</title> </serial> <serial> <code>VR34</code> <title>Ttttttt</title> </serial> </Products>
Merci à vous.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 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" version="1.0"> <xsl:output indent="yes"/> <xsl:template match="Products"> <Products > <xsl:apply-templates select="product"></xsl:apply-templates> </Products> </xsl:template> <xsl:template match="product"> <product> <xsl:for-each select="."> <xsl:sort select="translate(date,'-','')" order="descending"/> <ISBN><xsl:value-of select="ISBN"/></ISBN> <date><xsl:value-of select="substring(date, 0, 5)"/></date> </xsl:for-each> </product> </xsl:template> </xsl:stylesheet>
Philippe