0
http://www.google.com/support/news_pub/bin/answer.py?answer=93992在非空名稱空間下輸出元素URI
是否有創建站點地圖的簡單方法來支持Google新聞站點地圖。我一直在試圖找到一種將<news:news>
包含到XSLT中的方法,並且我不斷收到錯誤。
http://www.google.com/support/news_pub/bin/answer.py?answer=93992在非空名稱空間下輸出元素URI
是否有創建站點地圖的簡單方法來支持Google新聞站點地圖。我一直在試圖找到一種將<news:news>
包含到XSLT中的方法,並且我不斷收到錯誤。
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<urlset>
<url>
<loc>http://www.example.org/business/article55.html</loc>
<news:news>
<news:publication>
<news:name>The Example Times</news:name>
<news:language>en</news:language>
</news:publication>
<news:access>Subscription</news:access>
<news:genres>PressRelease, Blog</news:genres>
<news:publication_date>2008-12-23</news:publication_date>
<news:title>Companies A, B in Merger Talks</news:title>
<news:keywords>business, merger, acquisition, A,</news:keywords>
<news:stock_tickers>NASDAQ:A, NASDAQ:B</news:stock_tickers>
</news:news>
</url>
</urlset>
</xsl:template>
</xsl:stylesheet>
適用於任何XML輸入(未使用)的結果將是:
<?xml version="1.0" encoding="UTF-16"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<url>
<loc>http://www.example.org/business/article55.html</loc>
<news:news>
<news:publication>
<news:name>The Example Times</news:name>
<news:language>en</news:language>
</news:publication>
<news:access>Subscription</news:access>
<news:genres>PressRelease, Blog</news:genres>
<news:publication_date>2008-12-23</news:publication_date>
<news:title>Companies A, B in Merger Talks</news:title>
<news:keywords>business, merger, acquisition, A, B</news:keywords>
<news:stock_tickers>NASDAQ:A, NASDAQ:B</news:stock_tickers>
</news:news>
</url>
</urlset>
您已聲明瞭`news`前綴對應的命名空間? – Flack 2011-02-12 18:18:27
我該怎麼做? – BlindingDawn 2011-02-12 18:23:22