XSLT не работает, когда я включаю xmlns = «http://www.sitemaps.org/schemas/sitemap/0. 9 ”

Моя карта сайта Google хорошо отображается через XSLT без xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9" в элементе , однако, если он включен, мой foreach оператор не работает, и в шаблоне ничего не отображается. Мой код ниже. Спасибо за вашу помощь.

XML

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>{site_url}</loc>
<lastmod>{current_time format="%Y-%m-%d"}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</urlset>

XSL

<xsl:template match="/">
<html>
<body>
<h2>Sitemap</h2>
<table border="1">
<tr bgcolor="#9acd32">
  <th>Location</th>
  <th>Last Modified</th>
  <th>Update Frequency</th>
  <th>Priority</th>
</tr>
<xsl:for-each select="urlset/url">
<tr>
  <td><xsl:value-of select="loc"/></td>
  <td><xsl:value-of select="lastmod"/></td>
  <td><xsl:value-of select="changefreq"/></td>
  <td><xsl:value-of select="priority"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
12
задан Julian 1 October 2010 в 02:19
поделиться