Difference between revisions of "Fil RSS en XML"

From Wiki
Jump to navigation Jump to search
Line 5: Line 5:
 
** https://bootsnipp.com/snippets/BEW2z
 
** https://bootsnipp.com/snippets/BEW2z
 
** https://bootsnipp.com/search?q=blog&page=6
 
** https://bootsnipp.com/search?q=blog&page=6
 +
 +
 +
== 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>
 +
 +
<h2><xsl:value-of select="rss/channel/title"/></h2>
 +
<p><xsl:value-of select="rss/channel/lastBuildDate"/></p>
 +
 +
<xsl:for-each select="rss/channel/item">
 +
  <div>
 +
    <xsl:value-of select="enclosure/@url"/>
 +
    <a><xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute><h3><xsl:value-of select="title"/></h3></a>
 +
    <div><xsl:value-of select="description" disable-output-escaping="yes"/></div>
 +
    <img><xsl:attribute name="src"><xsl:value-of select="enclosure/@url"/></xsl:attribute></img>
 +
  </div>
 +
 
 +
</xsl:for-each>
 +
 +
</body>
 +
</html>
 +
</syntaxhighlight>

Revision as of 13:03, 21 May 2020

Liens


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>