[XSLT] Obtenir la valeur d'un noeud namespacé
Bonjour,
Je me résigne à poster ici mon problème en espérant trouver de l'aide car je n'ai pas fait de XSLT depuis un bon petit moment et je me casse la tête sur ce problème qui me semble pourtant simple.
J'essaie de transformer en une table HTML les résultats de mon flux RSS. Mon flux RSS se présente sous cette forme :
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 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
| <rss version="2.0">
<channel xmlns:dmx="http://www.bring2mind.net/dmx">
<title>Bibliothèque de fichiers</title>
<copyright/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx</link>
<language>fr-FR</language>
<description>Document Exchange Feed</description>
<item>
<title>ResourcePack.SimpleGallery.02.03.17.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=81</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=81</guid>
<pubDate>Thu, 10 Dec 2009 23:20:41 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>69</dmx:CollectionId>
<dmx:Created>2009-12-08 12:41:38Z</dmx:Created>
<dmx:LastModified>2009-12-10 23:20:41Z</dmx:LastModified>
<dmx:EntryId>81</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>39580</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.SimpleGallery.02.03.17.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Ventrian</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
<dmx:att2 dmx:name="Editeur">Core</dmx:att2>
<dmx:att3 dmx:name="Nom du module"></dmx:att3>
<dmx:att4 dmx:name="Site web de l'éditeur">www..com</dmx:att4>
<dmx:att5 dmx:name="Version du module">4.3.7</dmx:att5>
<dmx:att6 dmx:name="Commentaire de traduction">Repris de l'existant. Aucune note de traduction.</dmx:att6>
</item>
<item>
<title>ResourcePack.Core.04.03.07.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=49</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=49</guid>
<pubDate>Thu, 10 Dec 2009 23:13:57 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>7</dmx:CollectionId>
<dmx:Created>2009-12-08 12:36:00Z</dmx:Created>
<dmx:LastModified>2009-12-10 23:13:57Z</dmx:LastModified>
<dmx:EntryId>49</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>153914</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.Core.04.03.07.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Noyau</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
<dmx:att2 dmx:name="Editeur">Core</dmx:att2>
<dmx:att3 dmx:name="Nom du module"></dmx:att3>
<dmx:att4 dmx:name="Site web de l'éditeur">www..com</dmx:att4>
<dmx:att5 dmx:name="Version du module">4.3.7</dmx:att5>
<dmx:att6 dmx:name="Commentaire de traduction">Repris de l'existant. Aucune note de traduction.</dmx:att6>
</item>
<item>
<title>ResourcePack.Simple Gallery.02.02.06.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=80</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=80</guid>
<pubDate>Tue, 08 Dec 2009 12:41:37 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>69</dmx:CollectionId>
<dmx:Created>2009-12-08 12:41:37Z</dmx:Created>
<dmx:LastModified>2009-12-08 12:41:37Z</dmx:LastModified>
<dmx:EntryId>80</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>38067</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.Simple Gallery.02.02.06.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Ventrian</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
</item>
<item>
<title>ResourcePack.Quotes.01.01.01.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=79</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=79</guid>
<pubDate>Tue, 08 Dec 2009 12:41:37 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>69</dmx:CollectionId>
<dmx:Created>2009-12-08 12:41:37Z</dmx:Created>
<dmx:LastModified>2009-12-08 12:41:37Z</dmx:LastModified>
<dmx:EntryId>79</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>4147</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.Quotes.01.01.01.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Ventrian</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
</item>
<item>
<title>ResourcePack.PropertyAgent.01.07.12.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=78</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=78</guid>
<pubDate>Tue, 08 Dec 2009 12:41:36 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>69</dmx:CollectionId>
<dmx:Created>2009-12-08 12:41:36Z</dmx:Created>
<dmx:LastModified>2009-12-08 12:41:36Z</dmx:LastModified>
<dmx:EntryId>78</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>45127</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.PropertyAgent.01.07.12.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Ventrian</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
</item>
<item>
<title>ResourcePack.Property Agent.01.03.04.fr-FR</title>
<description/>
<link>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=77</link>
<author>email@email.com</author>
<guid>http://www.monurl.com/tabid/0/language/fr-FR/Default.aspx?Command=Core_Download&EntryId=77</guid>
<pubDate>Tue, 08 Dec 2009 12:41:35 GMT</pubDate>
<dmx:Author>SuperUser Account</dmx:Author>
<dmx:CollectionId>69</dmx:CollectionId>
<dmx:Created>2009-12-08 12:41:35Z</dmx:Created>
<dmx:LastModified>2009-12-08 12:41:35Z</dmx:LastModified>
<dmx:EntryId>77</dmx:EntryId>
<dmx:EntryType>File.Zip</dmx:EntryType>
<dmx:FileSize>30595</dmx:FileSize>
<dmx:Keywords/>
<dmx:OriginalFileName>ResourcePack.Property Agent.01.03.04.fr-FR.zip</dmx:OriginalFileName>
<dmx:Version>1</dmx:Version>
<dmx:FolderTitle>Ventrian</dmx:FolderTitle>
<dmx:Icon16>http://www.monurl.com/DesktopModules/Bring2mind/DMX/images/File.Zip.Gif</dmx:Icon16>
</item>
</channel>
</rss> |
Pour ce faire, j'utilise le fichier XSLT suivant :
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
| <?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dmx="http://www.bring2mind.com/dmx">
<xsl:output method="html" indent="yes"/>
<xsl:param name="ItemsToShow"/>
<xsl:param name="ShowItemDetails"/>
<xsl:param name="ShowItemDate"/>
<xsl:param name="Locale"/>
<xsl:template match="rss">
<table summary="Last Language Pack Table" id="businessTable">
<thead>
<tr>
<th scope="col"> <span>Editeur</span> </th>
<th scope="col"> <span>Module</span> </th>
<th scope="col"> <span>Version</span> </th>
</tr>
</thead>
<tbody>
<xsl:for-each select="channel/item[position()<=$ItemsToShow or $ItemsToShow<1]">
<tr class="sub">
<td class="head">Ici j'aimerai afficher la valeur de chaque dmx:att2</td>
<td>Ici j'aimerai afficher la valeur de chaque dmx:att3</td>
<td>Ici j'aimerai afficher la valeur de chaque dmx:att4</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet> |
Comment afficher la valeur du noeud dmx:att2 ???
Merci par avance pour toute aide que vous pourrez m'apporter :calim2:
Sébastien