IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XSL/XSLT/XPATH XML Discussion :

Comment dropper des balises


Sujet :

XSL/XSLT/XPATH XML

  1. #1
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut Comment dropper des balises
    Bonjour,

    J'ai besoin de votre aide svp !
    Pour une question qui semble un peu bête mais j'ai pas compris/trouvé de solutions jusqu'à maintenant...
    C'est certainement un peu noob mais je vais expliquer ce qui va te travers.

    J'ai un simple fichier XML du type :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <itema>item 1</itema>
    <valuea>value 1</valuea>
    Ma feuille XSL :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
     
    <xsl:template match="/">
      <xsl:apply-templates/>
    </xsl:template>
     
    <xsl:template match="valuea">
      <u><xsl:value-of select="valuea"/></u>
    </xsl:template>
     
    </xsl:stylesheet>
    Le résultat retourné :
    item 1
    value 1
    Oue, sauf que je voudrais pas que "item 1" soit affiché ! ^^
    Qu'est-ce que je fais de travers ?

    Merci à vous
    Goah Sha Kree

  2. #2
    Membre actif Avatar de amadoulamine1
    Inscrit en
    Avril 2005
    Messages
    260
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 260
    Points : 270
    Points
    270
    Par défaut
    la c'est un peu normal puisque tu lui a dit de tout afficher et de n'appliquer de transfrmation que sur valuea
    sinon tu devrai mettre ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
    <xsl:template match="*">
      <u><xsl:value-of select="//valuea"/></u>
    </xsl:template>
    </xsl:stylesheet>
    Ne testez jamais une erreur que vous ne savez pas gérer.
    de ne pas oublier

  3. #3
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut
    OK merci pour ta réponse. Effectivement dans ce cas, je comprend mieux.
    Toutefois, je ne crois pas pouvoir appliquer cette méthode pour l'idée que j'avais derrière la tête

    En fait, je suis parti du plus compliqué où j'avais le problème et j'ai simplifié jusqu'à isoler la partie la plus simple qui montrai ce qui n'allait pas.
    Au final, c'est un peu plus compliqué que ça (mais je ne voulais pas trop embrouiller dès le départ )

    Je souhaiterai faire un petit module de lecteur RSS, notamment pour les rédactionnels LDLC.

    L'URL du fil RSS :
    http://feeds2.feedburner.com/ldlc/co...-redactionnels

    Mon XSL :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
     
    <xsl:template match="item">
      <xsl:variable name="link">
        <xsl:value-of select="link"/>
      </xsl:variable>
      <a href="{$link}"><xsl:value-of select="title"/></a><br />
    </xsl:template>
     
    </xsl:stylesheet>
    Le code généré :
    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
    Rédactionnels LDLC.com
    http://www.ldlc.com/redactionnel/?origine=670083
    Les derniers articles réalisés par la rédaction.
    redaction@ldlc.com
    dev@ldlc.com
    fr
    Copyright 2009 Groupe-LDLC.com
    Thu, 12 Mar 2009 11:20:47 GMT
    30
     
    LDLC.com
    http://media.ldlc.com/ld/rss/logo-ldlc.gif
    http://www.ldlc.com/redactionnel/?origine=670083
    120
    48
     
    45.7754.778056Subscribe with NewsGatorSubscribe with BloglinesSubscribe with NetvibesSubscribe with GoogleSubscribe with Live.comSubscribe with Mon Yahoo!
    <a href="http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/ejqUEXTPOwk/microsoft-office-2007.html">Microsoft Office 2007</a><br>
     
    <a href="http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/yZDLtpBP6L0/genius-sp-hf2000x.html">Genius SP-HF2000X</a><br>
     
    [...]
    Donc j'ai toujours l'entête que je n'arrive pas à enlever...

    Merci d'avance pour ton aide
    Goah Sha Kree

  4. #4
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut
    Merci amadoulamine1 pour ton MP, je mets ici un extrait du code XML retourné par le flux RSS :
    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
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2frenchfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds2.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:ldlc="http://www.ldlc.com/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
    <title>Rédactionnels LDLC.com</title>
    <link>http://www.ldlc.com/redactionnel/?origine=670083</link>
    <description>Les derniers articles réalisés par la rédaction.</description>
    <managingEditor>redaction@ldlc.com</managingEditor>
    <webMaster>dev@ldlc.com</webMaster>
    <language>fr</language>
    <copyright>Copyright 2009 Groupe-LDLC.com</copyright>
     
    <lastBuildDate>Mon, 16 Mar 2009 09:20:48 GMT</lastBuildDate>
    <ttl>30</ttl>
    <image>
    <title>LDLC.com</title>
    <url>http://media.ldlc.com/ld/rss/logo-ldlc.gif</url>
    <link>http://www.ldlc.com/redactionnel/?origine=670083</link>
    <width>120</width>
    <height>48</height>
    </image>
    <geo:lat>45.775</geo:lat><geo:long>4.778056</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://www.ldlc.com/rss/articles-redactionnels.xml" type="application/rss+xml" /><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://www.ldlc.com/rss/articles-redactionnels.xml" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://add.my.yahoo.com/content?lg=fr&amp;url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/bn/intatm_fr_1.gif">Subscribe with Mon Yahoo!</feedburner:feedFlare>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000469-1/microsoft-office-2007.html?origine=670083</guid>
    <title>Microsoft Office 2007</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/ejqUEXTPOwk/microsoft-office-2007.html</link>
    <description>Microsoft Office 2007, suite puissante et conviviale de logiciels de productivité et de gestion des contacts, comprend de nouveaux outils pour vous faire gagner du temps, vous organiser et offrir un meilleur service client... Pour essayer Office 2007 immédiatement, il suffit de le télécharger !&lt;div class="feedflare"&gt;
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
     
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/ejqUEXTPOwk" height="1" width="1"/&gt;</description>
    <pubDate>Tue, 24 Feb 2009 12:22:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000469-1/microsoft-office-2007.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000464-1/genius-sp-hf2000x.html?origine=670083</guid>
    <title>Genius SP-HF2000X</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/yZDLtpBP6L0/genius-sp-hf2000x.html</link>
    <description>Les kits 2.1 ne sont pas forcement mieux qu'un système 2.0 bien conçu. Genius nous le prouve avec ce kit d'enceintes délivrant une bonne puissance tout en étant pratique : prise casque et entrée audio pour votre baladeur MP3 !&lt;div class="feedflare"&gt;
     
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/yZDLtpBP6L0" height="1" width="1"/&gt;</description>
     
    <pubDate>Tue, 10 Mar 2009 14:31:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000464-1/genius-sp-hf2000x.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000463-1/le-clavier-ideal-pour-votre-salon.html?origine=670083</guid>
    <title>Le clavier idéal pour votre salon</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/lPBd6ycDR-U/le-clavier-ideal-pour-votre-salon.html</link>
    <description>Piloter un PC branché sur sa télévision depuis le canapé devient facile avec ce clavier. Professionnels, il vous sera également utile pour vos conférences. Sa connexion sans fil, son trackball et ses touches multimédias vous rendront services et vous apprécierez d'autant plus votre équipement.&lt;div class="feedflare"&gt;
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
     
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/lPBd6ycDR-U" height="1" width="1"/&gt;</description>
    <pubDate>Tue, 10 Mar 2009 14:32:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000463-1/le-clavier-ideal-pour-votre-salon.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000462-1/cooler-master-sniper.html?origine=670083</guid>
    <title>Cooler Master Sniper</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/IWzCs5EGxmw/cooler-master-sniper.html</link>
    <description>Le nouveau boîtier Cooler Master Sniper est disponible depuis quelques jours et les premiers clients sont ravis : "Une tour hyper extra bien !" s'exclame Rudy.C. Découvrez sans plus tarder les qualités du boîtier Sniper aux travers de nos nombreuses photos...&lt;div class="feedflare"&gt;
     
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/IWzCs5EGxmw" height="1" width="1"/&gt;</description>
     
    <pubDate>Mon, 16 Feb 2009 10:22:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000462-1/cooler-master-sniper.html?origine=670083</feedburner:origLink>
    </item>
    Merci d'avance
    Goah Sha Kree

  5. #5
    Membre actif Avatar de amadoulamine1
    Inscrit en
    Avril 2005
    Messages
    260
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 260
    Points : 270
    Points
    270
    Par défaut
    Je comprend pa trop quesque tu veux ne pas afficher ce qui est dans les <item>?
    bon en tout cas essaie avec ca je sais pas si c'est exactement ce que tu veux
    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
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
    <xsl:template match="*">
    	<xsl:for-each select = "*">
    		<xsl:for-each select = "item">
    			<xsl:element name="a">
    				<xsl:attribute  name = "href" >
    					<xsl:value-of select="link"/>
    				</xsl:attribute>
    				<xsl:value-of select="title"/>
    			</xsl:element><br/>
    		</xsl:for-each>
    	</xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Ne testez jamais une erreur que vous ne savez pas gérer.
    de ne pas oublier

  6. #6
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut
    Ben, en fait si sur le 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
    76
     
    Par défaut
    Merci amadoulamine1 pour ton MP, je mets ici un extrait du code XML retourné par le flux RSS :
    Code :
     
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2frenchfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds2.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:ldlc="http://www.ldlc.com/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
    <title>Rédactionnels LDLC.com</title>
    <link>http://www.ldlc.com/redactionnel/?origine=670083</link>
    <description>Les derniers articles réalisés par la rédaction.</description>
    <managingEditor>redaction@ldlc.com</managingEditor>
    <webMaster>dev@ldlc.com</webMaster>
    <language>fr</language>
    <copyright>Copyright 2009 Groupe-LDLC.com</copyright>
     
    <lastBuildDate>Mon, 16 Mar 2009 09:20:48 GMT</lastBuildDate>
    <ttl>30</ttl>
    <image>
    <title>LDLC.com</title>
    <url>http://media.ldlc.com/ld/rss/logo-ldlc.gif</url>
    <link>http://www.ldlc.com/redactionnel/?origine=670083</link>
    <width>120</width>
    <height>48</height>
    </image>
    <geo:lat>45.775</geo:lat><geo:long>4.778056</geo:long><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://www.ldlc.com/rss/articles-redactionnels.xml" type="application/rss+xml" /><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://www.ldlc.com/rss/articles-redactionnels.xml" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://add.my.yahoo.com/content?lg=fr&amp;url=http%3A%2F%2Fwww.ldlc.com%2Frss%2Farticles-redactionnels.xml" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/bn/intatm_fr_1.gif">Subscribe with Mon Yahoo!</feedburner:feedFlare>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000469-1/microsoft-office-2007.html?origine=670083</guid>
    <title>Microsoft Office 2007</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/ejqUEXTPOwk/microsoft-office-2007.html</link>
    <description>Microsoft Office 2007, suite puissante et conviviale de logiciels de productivité et de gestion des contacts, comprend de nouveaux outils pour vous faire gagner du temps, vous organiser et offrir un meilleur service client... Pour essayer Office 2007 immédiatement, il suffit de le télécharger !&lt;div class="feedflare"&gt;
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=ejqUEXTPOwk:67Og_wajYbM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
     
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/ejqUEXTPOwk" height="1" width="1"/&gt;</description>
    <pubDate>Tue, 24 Feb 2009 12:22:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000469-1/microsoft-office-2007.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000464-1/genius-sp-hf2000x.html?origine=670083</guid>
    <title>Genius SP-HF2000X</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/yZDLtpBP6L0/genius-sp-hf2000x.html</link>
    <description>Les kits 2.1 ne sont pas forcement mieux qu'un système 2.0 bien conçu. Genius nous le prouve avec ce kit d'enceintes délivrant une bonne puissance tout en étant pratique : prise casque et entrée audio pour votre baladeur MP3 !&lt;div class="feedflare"&gt;
     
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=yZDLtpBP6L0:gQ9YA6uHTik:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/yZDLtpBP6L0" height="1" width="1"/&gt;</description>
     
    <pubDate>Tue, 10 Mar 2009 14:31:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000464-1/genius-sp-hf2000x.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000463-1/le-clavier-ideal-pour-votre-salon.html?origine=670083</guid>
    <title>Le clavier idéal pour votre salon</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/lPBd6ycDR-U/le-clavier-ideal-pour-votre-salon.html</link>
    <description>Piloter un PC branché sur sa télévision depuis le canapé devient facile avec ce clavier. Professionnels, il vous sera également utile pour vos conférences. Sa connexion sans fil, son trackball et ses touches multimédias vous rendront services et vous apprécierez d'autant plus votre équipement.&lt;div class="feedflare"&gt;
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=lPBd6ycDR-U:mYii3Zu5t28:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
     
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/lPBd6ycDR-U" height="1" width="1"/&gt;</description>
    <pubDate>Tue, 10 Mar 2009 14:32:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000463-1/le-clavier-ideal-pour-votre-salon.html?origine=670083</feedburner:origLink>
    </item>
     
    <item>
    <guid isPermaLink="false">http://www.ldlc.com/articles/AL00000462-1/cooler-master-sniper.html?origine=670083</guid>
    <title>Cooler Master Sniper</title>
    <link>http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/IWzCs5EGxmw/cooler-master-sniper.html</link>
    <description>Le nouveau boîtier Cooler Master Sniper est disponible depuis quelques jours et les premiers clients sont ravis : "Une tour hyper extra bien !" s'exclame Rudy.C. Découvrez sans plus tarder les qualités du boîtier Sniper aux travers de nos nombreuses photos...&lt;div class="feedflare"&gt;
     
    &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:yIl2AUoC8zA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?a=IWzCs5EGxmw:i4Z3fa-_oso:7Q72WNTAKBA"&gt;&lt;img src="http://feeds2.feedburner.com/~ff/ldlc/com/rss/articles-redactionnels?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
    &lt;/div&gt;&lt;img src="http://feeds2.feedburner.com/~r/ldlc/com/rss/articles-redactionnels/~4/IWzCs5EGxmw" height="1" width="1"/&gt;</description>
     
    <pubDate>Mon, 16 Feb 2009 10:22:00 GMT</pubDate>
    <feedburner:origLink>http://www.ldlc.com/articles/AL00000462-1/cooler-master-sniper.html?origine=670083</feedburner:origLink>
    </item>
    J'applique le XSL :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
     
    <xsl:template match="item">
      <xsl:variable name="link">
        <xsl:value-of select="link"/>
      </xsl:variable>
      <a href="{$link}"><xsl:value-of select="title"/></a><br />
    </xsl:template>
     
    </xsl:stylesheet>
    Ca me donne :
    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
    Rédactionnels LDLC.com
    http://www.ldlc.com/redactionnel/?origine=670083
    Les derniers articles réalisés par la rédaction.
    redaction@ldlc.com
    dev@ldlc.com
    fr
    Copyright 2009 Groupe-LDLC.com
    Thu, 12 Mar 2009 11:20:47 GMT
    30
     
    LDLC.com
    http://media.ldlc.com/ld/rss/logo-ldlc.gif
    http://www.ldlc.com/redactionnel/?origine=670083
    120
    48
     
    45.7754.778056Subscribe with NewsGatorSubscribe with BloglinesSubscribe with NetvibesSubscribe with GoogleSubscribe with Live.comSubscribe with Mon Yahoo!
    <a href="http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/ejqUEXTPOwk/microsoft-office-2007.html">Microsoft Office 2007</a><br>
     
    <a href="http://feedproxy.google.com/~r/ldlc/com/rss/articles-redactionnels/~3/yZDLtpBP6L0/genius-sp-hf2000x.html">Genius SP-HF2000X</a><br>
     
    [...]
    Alors que je ne veux pas que tout le début s'affiche, mais uniquement le contenu des item.

    J'essaye ta solution. (même si sur le principe les templates sont fait pour être appliqués à chaque itération de la balise. Donc c'est quand même dommage sur le principe de devoir faire un foreach...
    (Toutefois, il est possible qu'au final j'opte pour cette solution, car j'aimerai bien n'afficher que les n premiers item)
    Goah Sha Kree

  7. #7
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut
    J'essaye de bidouiller pour coller précisément à ce que je veux faire, mais y a quand même un truc que je comprends pas.
    Pourquoi ça, ça ne marche pas ?! oO

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
    <xsl:template match="/">
      <xsl:for-each select = "item">
        <xsl:element name="a">
          <xsl:attribute  name = "href" >
            <xsl:value-of select="link"/>
          </xsl:attribute>
          <xsl:value-of select="title"/>
        </xsl:element><br/>
      </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Logiquement, je match la racine et j'applique pour tous les "item", et pourtant, le résultat est vide...
    Goah Sha Kree

  8. #8
    Membre actif Avatar de amadoulamine1
    Inscrit en
    Avril 2005
    Messages
    260
    Détails du profil
    Informations forums :
    Inscription : Avril 2005
    Messages : 260
    Points : 270
    Points
    270
    Par défaut
    la je te fais savoir que tu ne boucle que sur un seul item.
    donc tu naura le reseulta que d'un seul item
    à la limite tu pouvai boucler sur channel ...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
    <xsl:template match="*">
    	<xsl:for-each select = "channel//item">
    	    <xsl:element name="a">
    	        <xsl:attribute  name = "href" >
    		    <xsl:value-of select="link"/>
    		</xsl:attribute>
    		<xsl:value-of select="title"/>
    	   </xsl:element><br/>
         </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    par contre pour le match je remplace par "/" mon cooktop plante ...
    Ne testez jamais une erreur que vous ne savez pas gérer.
    de ne pas oublier

  9. #9
    Membre actif
    Avatar de jak0
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    272
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2005
    Messages : 272
    Points : 219
    Points
    219
    Par défaut
    OK merci. C'est bon j'ai réussi à bidouiller.
    Avec en prime une limitation sur le nombre d'éléments affichés, voilà mon XSL final
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version="1.0">
    <xsl:output method="html" encoding="ISO-8859-1"/>
     
    <xsl:template match="channel">
      <xsl:for-each select="item[position() &lt;= 5]">
          <xsl:param name="link"/>
          <p class="rss_date"><xsl:value-of select="substring(pubDate, 5, 12)"/> :</p>
          <li class="rss_item"><a href="{$link}"><xsl:value-of select="title"/></a></li>
      </xsl:for-each>
    </xsl:template>
     
    </xsl:stylesheet>
    Merci encore. Je tag en résolu
    Goah Sha Kree

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. comment gérer des balises XML avec le meme nom
    Par banjaman dans le forum VBA Access
    Réponses: 0
    Dernier message: 27/05/2015, 10h18
  2. Réponses: 4
    Dernier message: 30/05/2011, 12h14
  3. [CS4] Comment supprimer des balises de date ?
    Par Spriter dans le forum Dreamweaver
    Réponses: 8
    Dernier message: 27/12/2010, 22h42
  4. [XML] [Débutant]Comment ajouter des balise html dans un fichier XML
    Par pierrot10 dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 18/09/2010, 14h36
  5. XSLT : Comment afficher des balises XML dans un attribut ?
    Par mr.mams dans le forum XSL/XSLT/XPATH
    Réponses: 5
    Dernier message: 27/04/2009, 15h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo