Debugging your XML sitemap with an XSL Stylesheet

When you’re developing XML sitemaps, no matter on what platform, it’s pretty hard to debug them sometimes to be proper XML. You have to validate all the time and you can’t do a quick “glance” over to see whether your sitemap has the URL’s you were expecting.

As mentioned before I’m working on my WordPress SEO plugin, and it’ll do sitemaps, three kinds of sitemaps actually: video, news and normal. For all three of them I’ve developed so called XSL stylesheets, so I can quickly glance over a sitemap and get an idea as to whether everything I expected to be in there is actually there. An XSL stylesheets transforms an XML document into HTML output, for instance, for a normal XML sitemap, that looks like this:

Styled XML Sitemap

Click for larger image

And for an XML video sitemap:

Styled XML Video Sitemap

Click for larger image

Especially with the recent addons to the sitemaps protocol (check out the image count in the first “normal” sitemap for instance), this makes it a lot easier to see if you’re doing things wrong. On top of that, using some jQuery, the headers are sortable!


Because I know you want your own XML sitemaps to look this good too, I’ll release my XSL stylesheets here:

XSL stylesheets for XML Sitemaps


Usage of these XSL stylesheets is easy, just add a line like this to the top of your XML output:

<?xml-stylesheet type='text/xsl' href='/url/to/xsl-stylesheet.xsl'?>

Let me know whether you like this, and what you’d like to add to these XSL stylesheets!

13 Responses

  1. Emma B
    By Emma B on 29 June, 2010


    I am currently in the process of putting together a video sitemap but have a couple of questions:

    1) If you have the same video on a couple of URLs do you have to do a reference for each URL or is is acceptable to put several URLs in one reference?
    2) What do you put as the URL if the video is part of a macro that is placed on several pages as a result of being copied across from the CSS?


    • Joost de Valk
      By Joost de Valk on 29 June, 2010

      1: pick one URL and go for that, don’t host the same video on multiple pages, especially not for Google.
      2: I don’t get this question :)

  2. Sam
    By Sam on 1 July, 2010

    Nice work Joost!
    Emma, Like Joost said for 1,2) it is not a good idea to host your video on multiple pages, if you have to to do it, then just pick one URL regardless of the macro.

  3. jakob
    By jakob on 3 July, 2010

    Thanks, I desperately needed this info!

  4. DB Baker
    By DB Baker on 5 July, 2010

    Thanks Yoast, it looks great.

    Any idea when your WordPress SEO Plugin is going to be finished and released to the public?

    • Joost de Valk
      By Joost de Valk on 5 July, 2010

      That’ll take a couple of months :)

      • DB Baker
        By DB Baker on 5 July, 2010

        Cool. Just one more question. If I am running thesis would your plugin provide an edge over the built in SEO functions that are coming with the thesis theme ?

  5. Jen
    By Jen on 5 July, 2010

    That plugin is desperately needed – to many separate plugins right now to do these functions: one for URLs, one for Video, etc
    Bring on the plugin Joost!

  6. JB
    By JB on 5 July, 2010

    Cool, just what I am looking for. Keep up the good the work

  7. Jared Detroit
    By Jared Detroit on 6 July, 2010

    Thanks for the style sheets. These will be a much needed addition to my sitemaps. Not only for me but also for my clients. It’s always good to show them what you’ve created, for something like a video sitemap, in a good format. Thanks!

    I’m really looking forward to this SEO plugin and I’m excited to hear it’s going to be more of an all exclusive plugin with sitemaps included. That will make my life a little easier installation.

  8. rob
    By rob on 7 July, 2010

    I am a fan of yours, I used almost all your plugin and been waiting for your SEO Plugin…
    This one also is good…

  9. Paul
    By Paul on 8 July, 2010


    I am having such problems submitting my site map. I think I do it exactly as indicated but always seem to get an error. I am not an idiot. Please tell me when you release a plugin I am getting dishearten with trying to make any money online.