Correct XSLT syntax for Google multilingual sitemaps/ xhtml:link

ساخت وبلاگ

Vote count: 0

I have an XML sitemap for a multilingual site that follows Google's specifications for multilingual sitemaps using the xhtml:link tags.

The syntax looks like this:

 <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>

I'm trying to make this human readable for the client using an XSLT template like this:

 <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>

Which works without the xhtml:link tags. But I'm not sure how to correctly reference the xhtml:link tags. I've tried something like this:

<xsl:for-each select="xhtml:link"> <tr> <td> <xsl:value-of select="xhtml:link@href"/> </td> <td> <xsl:value-of select="xhtml:link@hreflang"/> </td> <td colspan="2"></td> </tr>
</xsl:for-each>

But that's not working.

What is the correct XSLT syntax for looping through/ selecting xhtml:link tags in Google multilingual sitemaps?

asked 37 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 258 تاريخ : چهارشنبه 27 مرداد 1395 ساعت: 7:05