Difference between revisions of "Fil RSS en XML"

From Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 +
== Demo ==
 +
* http://code.sitegb.com/projet-rss/
 +
 
== Liens ==
 
== Liens ==
 
 
* Radio Canada : https://ici.radio-canada.ca/rss
 
* Radio Canada : https://ici.radio-canada.ca/rss
 
* Gabarits Bootstrap
 
* Gabarits Bootstrap

Revision as of 05:54, 22 May 2020

Demo

Liens


Etapes

  • Explorer la structure XML du fil RSS
  • Ajouter un fichier XLS pour transformer le XML en HTML
    • value-of
    • boucle for-each
    • gestion des attributs HTML
    • tag XML / attribut XML
    • CData
  • Mettre en forme avec gabarit Bootstrap
  • Utilisation dynamique (vrai fil RSS) avec php
  • Navigation micro site


Exemple de code

XSL pour fil RSS

<syntaxhighlight lang="xml"> <?xml version="1.0" encoding="UTF-8"?> <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <body>

<xsl:value-of select="rss/channel/title"/>

<xsl:value-of select="rss/channel/lastBuildDate"/>

<xsl:for-each select="rss/channel/item">

   <xsl:value-of select="enclosure/@url"/>
<a><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute>

<xsl:value-of select="title"/>

</a>
<xsl:value-of select="description" disable-output-escaping="yes"/>
   <img><xsl:attribute name="src"><xsl:value-of select="enclosure/@url"/></xsl:attribute></img>

</xsl:for-each>

</body> </html> </syntaxhighlight>