Author: Steven Neiland

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

XSL Breakdown

As there is so much going on in the previous code I have broken it down by the key components. I have done this by working inwards by tag pair.

XSL Declaration & Stylesheet Wrapper

The first components of our xsl sheet are the xsl version namespace declarations and the desired output format of html using utf-8 encoding.

<xsl:stylesheet version="2.0"xmlns:html=""xmlns:sitemap=""xmlns:xsl="">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>


Template Wrapper

Inside the stylesheet wrapper we have a template wrapper

<xsl:template match="/">


Variable Declarations

Inside the template wrapper are two variable declarations. These variables named upper and lower will be used further down the code.

    <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>

Standard HTML

You will notice that there is standard html mixed in with the xsl code. This is no different to the way you have standard code mixed in with cfml.

For-Each Loop

This is where we start to see the power of xsl. This statement selects the urlset wrapper from our sitemap and loops through each url node in it.

   <xsl:for-each select="sitemap:urlset/sitemap:url">

1 2 3 4 5 6 7

What Do You Think?

Reader Comments

Post a Comment

Comment Etiquette:

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain or appear to be advertisments, will not be published.
  • Comments that appear to be created for the purpose of linkbuilding to commercial sites will be removed.

We are all adults here so play nice.


Archives Blog Listing

Tag Listing

Learn CF In A Week


Fork me on GitHub