【发布时间】:2014-04-23 07:41:06
【问题描述】:
我正在使用此页面作为指南尝试 XSLT: http://www.w3schools.com/xml/xml_xsl.asp
我基本上尝试修改给定的 XSL 信息以适合我的标签,这些标签恰好是站点地图的形式。但是,当我将 XSL 样式应用到我的 XML 页面时,它显示为空白!显然我错过/忘记或没有看到某些东西。请帮忙。
我的 XML(仅限 sn-p):
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="style.xsl" ?>
<!-- sitemap-generator-url="http://www.auditmypc.com/free-sitemap-generator.asp" -->
<!-- This sitemap was created using the free tool found here: http://www.auditmypc.com/free-sitemap-generator.asp -->
<!-- Audit My PC also offers free security tools to help keep you safe during internet travels -->
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
>
<url>
<loc>http://www.site.com/</loc>
<lastmod>2014-03-17T13:30:25-05:00</lastmod>
</url>
<url>
<loc>http://www.site.com/index.php?format=feed&type=rss</loc>
<lastmod>2014-03-17T13:28:20-05:00</lastmod>
</url>
</urlset>
我的 XSL:
<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="urlset/url">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="loc"/></span>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<span>Last Modified:<xsl:value-of select="lastmod"/></span>
</div>
</xsl:for-each>
</body>
</html>
感谢您的帮助!
【问题讨论】: