<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" indent="yes"/>
  <xsl:variable name="pagename" select="normalize-space(/album/albumName/text())"/>

  <xsl:template match="/album">
    <div>
      <script type="text/javascript" src="/lightbox/js/prototype.js"></script>
      <script type="text/javascript" src="/lightbox/js/scriptaculous.js?load=effects"></script>
      <script type="text/javascript" src="/lightbox/js/lightbox.js"></script>
      <p></p>
      <br clear="all" />
      <p>
        <xsl:apply-templates select="images/image"/>
      <br clear="all" />
      </p>
<p class="fineprint">Image display: <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox JS v2.0</a> by Lokesh Dhakar</p>
    </div>
  </xsl:template>

  <xsl:template match="image">
    <div class="picasathumb">
      <xsl:element name="a">
        <xsl:attribute name="href">/<xsl:value-of select="$pagename"/>/<xsl:value-of select="normalize-space(itemLargeImage/text())"/></xsl:attribute>
        <xsl:attribute name="rel">lightbox[<xsl:value-of select="$pagename"/>]</xsl:attribute>
        <xsl:attribute name="title"><xsl:value-of select="normalize-space(itemCaption/text())"/></xsl:attribute>
        <xsl:element name="img">
          <xsl:attribute name="src">/<xsl:value-of select="$pagename"/>/<xsl:value-of select="normalize-space(itemThumbnailImage/text())"/></xsl:attribute>
        </xsl:element>
      </xsl:element>
    </div>
  </xsl:template>
</xsl:stylesheet>