我有一個使用xhtml:link
標記的Google's specifications for multilingual sitemaps多語言站點的XML站點地圖。Google多語言站點地圖/ xhtml的正確XSLT語法:鏈接
的語法如下:
<url>
<loc>http://www.example.com/url-segment/</loc>
<xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/url-segment/" />
<xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/de/url-segment/" />
<xhtml:link rel="alternate" hreflang="fr" href="http://www.example.com/fr/url-segment/" />
<lastmod>2016-08-09T00:41:57+12:00</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
我試圖使這個人類可讀的使用XSLT模板,像這樣的客戶:
<xsl:for-each select="sitemap:urlset/sitemap:url">
<tr>
<td>
<xsl:variable name="itemURL">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
</td>
<td>
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
</td>
<td>
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
</td>
<td>
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
</td>
</tr>
</xsl:for-each>
沒有xhtml:link
標籤其中一期工程。但我不確定如何正確引用xhtml:link
標籤。我試過這樣的事情:
<xsl:for-each select="xhtml:link">
<tr>
<td>
<xsl:value-of select="xhtml:[email protected]"/>
</td>
<td>
<xsl:value-of select="xhtml:[email protected]"/>
</td>
<td colspan="2"></td>
</tr>
</xsl:for-each>
但這不起作用。
什麼是在Google多語言站點地圖中循環/選擇xhtml:link
標記的正確XSLT語法?