Bonjour,
Je cherche à supprimer tous les doublons, pour cela j'utilise la méthode muench.
xml:
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 <?xml version="1.0" encoding="ISO-8859-1"?> <page> <bulletinInfo> <nbLines>135</nbLines> <agent> <matricule>00237238</matricule> </agent> <bullRef>2004_08_00237238</bullRef> </bulletinInfo> <bulletinInfo> <nbLines>195</nbLines> <agent> <matricule>00237238</matricule> </agent> <bullRef>2004_08_00237238</bullRef> </bulletinInfo> <bulletinInfo> <nbLines>35</nbLines> <agent> <matricule>00237238</matricule> </agent> <bullRef>2004_08_00237238</bullRef> </bulletinInfo><bulletinInfo> <nbLines>195</nbLines> <agent> <matricule>00237238</matricule> </agent> <bullRef>2004_08_00237238</bullRef> </bulletinInfo> </page>
Cela fonctionne, mais j'aimerai de garde que le noeud bulletinInfo ayant un nbLines maximum. Je suppose qu'il faudrait quelque chose de plus complexe que le [1], mais pour le moment je seche.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="id" match="bulletinInfo" use="agent/matricule"/> <xsl:template match="/"> <page> <xsl:for-each select="//bulletinInfo[generate-id()=generate-id(key('id', agent/matricule)[1])]"> <xsl:copy-of select='.'/> </xsl:for-each> </page> </xsl:template> </xsl:stylesheet>
Si vous avez des idées sur comment procéder je prends.
Partager