Advertisement
Guest User

google-news-sitemap.xsl

a guest
Nov 19th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.57 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="2.0"
  3.     xmlns:html="http://www.w3.org/TR/REC-html40"
  4.     xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
  5.     xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
  6.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  7. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  8. <xsl:template match="/">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11.     <title>Google News Sitemap Feed</title>
  12.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13.     <style type="text/css">body{font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;font-size:13px}#header,#footer{padding:2px;margin:10px;font-size:8pt;color:gray}a{color:black}td{font-size:11px}th{text-align:left;padding-right:30px;font-size:11px}tr.high{background-color:whitesmoke}#footer img{vertical-align:middle}</style>
  14. </head>
  15. <body>
  16.     <h1>Google News Sitemap Feed</h1>
  17.     <div id="header">
  18.         <p>This is a <a href="https://support.google.com/news/publisher/answer/75717" target="_blank">Google News Sitemap</a> to aid <a href="https://news.google.com" target="_blank">Google News</a> finding news on your website. Please note that <strong><em>only posts from the last 48 hours</em></strong> will be processed by Google News.</p>
  19.     </div>
  20.     <div id="content">
  21.         <table cellpadding="5">
  22.             <tr class="high">
  23.                 <th>#</th>
  24.                 <th>Title</th>
  25.                 <th>Language</th>
  26.                 <th>Keyword(s)</th>
  27.                 <th>Publication Date</th>
  28.             </tr>
  29. <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
  30. <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  31. <xsl:for-each select="sitemap:urlset/sitemap:url">
  32.             <tr><xsl:if test="position() mod 2 != 1"><xsl:attribute  name="class">high</xsl:attribute></xsl:if>
  33.                 <td><xsl:value-of select="position()"/></td>
  34.                 <td><xsl:variable name="itemURL"><xsl:value-of select="sitemap:loc"/></xsl:variable>
  35.                     <a href="{$itemURL}"><xsl:value-of select="news:news/news:title"/></a>
  36.                 </td>
  37.                 <td><xsl:value-of select="news:news/news:publication/news:language"/></td>
  38.                 <td><xsl:value-of select="news:news/news:keywords"/></td>
  39.                 <td><xsl:value-of select="concat(substring(news:news/news:publication_date,0,11),concat(' ', substring(news:news/news:publication_date,12,8)))"/> (<xsl:value-of select="substring(news:news/news:publication_date,20,6)"/>)</td>
  40.             </tr>
  41. </xsl:for-each>
  42.         </table>
  43.     </div>
  44.     <div id="footer">
  45.         <p>XML Google News Sitemap for <a href="https://wordpress.org/">WordPress</a>.</p>
  46.     </div>
  47. </body>
  48. </html>
  49. </xsl:template>
  50. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement