Moja mapa witryny Google renderuje dobrze XSLT bez Xmlns = "http: //www.sitemaps. org/schemas/sitemap/0.9 "w elemencie urlset> <, jednak jeśli jest zawarte, moje oświadczenie foreach nie działa i nic nie renderuje w szablonie. Mój kod jest poniżej. Dzięki za pomoc.XSLT nie działa, gdy dołączam xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9"
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>
Dobre pytanie (+1). Zobacz moją odpowiedź na wyjaśnienie i pełne rozwiązanie. –