Hello everyone, hope this is the right place. I am working on modifying a xsl sitemap template from
http://yoast.com/xsl-stylesheet-xml-sitemap/
I've cleaned it up, as I'd like to use it as a image sitemap only, pulling the image url location, and caption from the xml. However, I have absolutely no idea how to modify the code to do this. I've played with a lot of changes however my programming knowledge is aweful.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://tablesorter.com/jquery.tablesorter.min.js"></script>
<script type="text/javascript"><![CDATA[
$(document).ready(function() {
$("#sitemap").tablesorter( { widgets: ['zebra'] } );
});
]]></script>
</head>
<body>
<div id="content">
<h1>XML Image Sitemap</h1>
<p class="expl">
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
</p>
<table id="sitemap" cellpadding="3">
<thead>
<tr>
<th width="75%">URL</th>
<th width="25%">Description</th>
</tr>
</thead>
<tbody>
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:for-each select="sitemap:urlset/sitemap:url">
<tr>
<td>
<xsl:variable name="itemURL">
<xsl:value-of select="sitemap:loc"/>
</xsl:variable>
<a href="{$itemURL}">
<xsl:value-of select="sitemap:loc"/>
</a>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
My xml format is like this:
Code:
<url>
<loc>http://www.bookboxshop.com/product/davinci-project-bk-61/</loc>
<image:image>
<image:loc>http://www.bookboxshop.com/images/Leonardo-da-Vinci-Book-Box-Detail.png</image:loc>
<image:caption>Leonardo da Vinci Book-Box</image:caption>
</image:image>
</url>
Currently, the xsl code pulls the <loc>, whereas I'd like it to display the <image:loc>. I'd like the description field to pull the <image:caption> field. I thought it would be simple, but it is beyond my efforts.
Any help would be tremendously appreciated!
Thanks
Michael