Warning, /graphics/digikam/core/dplugins/generic/tools/htmlgallery/themes/vanilla/template.xsl is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="UTF-8" ?>
0002 
0003 <!--
0004  * ============================================================
0005  *
0006  * This file is a part of digiKam project
0007  * https://www.digikam.org
0008  *
0009  * Date        : 2007-10-27
0010  * Description : A based on the default Adobe Lighroom theme
0011  *               for the digiKam html gallery tool.
0012  *
0013  * SPDX-FileCopyrightText: 2007 by Wojciech Jarosz <wjarosz at ucsd dot edu>
0014  *
0015  * SPDX-License-Identifier: GPL-2.0-or-later
0016  *
0017  * ============================================================
0018  -->
0019 
0020 <xsl:transform version="1.0"
0021   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
0022   xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
0023 <xsl:output
0024   method="xml"
0025   indent="yes" 
0026   encoding="iso-8859-1" 
0027   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
0028   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
0029 
0030 
0031 <!-- ##################### VARIABLE INITIALIZATION ######################## -->
0032 <!-- Initialize some useful variables -->
0033 <xsl:variable name="theme" select="'grey'" />
0034 <xsl:variable name="outerBorder" select="boolean(0)" />
0035 <xsl:variable name="resizeSpeed" select="10" />
0036 <xsl:variable name="maxOpacity" select="80" />
0037 <xsl:variable name="navType" select="1" />
0038 <xsl:variable name="autoResize" select="boolean(1)" />
0039 <xsl:variable name="doAnimations" select="boolean(1)" />
0040 <xsl:variable name="showNavigation" select="boolean(1)" />
0041 <xsl:variable name="numCollections" select="count(collections/collection)" />
0042 <xsl:variable name="pageSize" select="$numRows * $numCols" />
0043 <xsl:variable name="maxThumbWidth">
0044   <xsl:for-each select="collections/collection/image/thumbnail">
0045     <xsl:sort select="number(@width)" data-type="number" order="descending" />
0046     <xsl:if test="position()=1">
0047       <xsl:value-of select="number(@width)" />
0048     </xsl:if>
0049   </xsl:for-each>
0050 </xsl:variable>
0051 <xsl:variable name="maxThumbHeight">
0052   <xsl:for-each select="collections/collection/image/thumbnail">
0053     <xsl:sort select="number(@height)" data-type="number" order="descending" />
0054     <xsl:if test="position()=1">
0055       <xsl:value-of select="number(@height)" />
0056     </xsl:if>
0057   </xsl:for-each>
0058 </xsl:variable>
0059 <xsl:variable name="maxFullWidth">
0060   <xsl:for-each select="collections/collection/image/full">
0061     <xsl:sort select="number(@width)" data-type="number" order="descending" />
0062     <xsl:if test="position()=1">
0063       <xsl:value-of select="number(@width)" />
0064     </xsl:if>
0065   </xsl:for-each>
0066 </xsl:variable>
0067 <xsl:variable name="maxFullHeight">
0068   <xsl:for-each select="collections/collection/image/full">
0069     <xsl:sort select="number(@height)" data-type="number" order="descending" />
0070     <xsl:if test="position()=1">
0071       <xsl:value-of select="number(@height)" />
0072     </xsl:if>
0073   </xsl:for-each>
0074 </xsl:variable>
0075 
0076         
0077 <!-- ##################### COLLECTION PAGES GENERATION #################### -->
0078 <xsl:template name="collectionPages">
0079   <xsl:call-template name="collectionPages.for.loop">
0080     <xsl:with-param name="i" select="1" />
0081     <xsl:with-param name="count" select="ceiling(count(image) div $pageSize)" />
0082   </xsl:call-template>
0083 </xsl:template>
0084 
0085 <!-- For loop used to generate collection pages -->
0086 <xsl:template name="collectionPages.for.loop">
0087   <xsl:param name="i" />
0088   <xsl:param name="count" />
0089   
0090   <xsl:if test="$i &lt; $count">
0091     <xsl:variable name="pageFilename" select="concat(fileName, '_', $i, '.html')" />
0092     <exsl:document href="{$pageFilename}"
0093       method="xml"
0094       indent="yes" 
0095       encoding="iso-8859-1" 
0096       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
0097       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN">
0098       <xsl:call-template name="collectionPage">
0099         <xsl:with-param name="pageNum" select="$i" />
0100         <xsl:with-param name="pageFilename" select="$pageFilename" />
0101       </xsl:call-template>
0102     </exsl:document>
0103 
0104     <xsl:call-template name="collectionPages.for.loop">
0105       <xsl:with-param name="i" select="$i + 1" />
0106       <xsl:with-param name="count" select="$count" />
0107     </xsl:call-template>
0108   </xsl:if>
0109 </xsl:template>
0110 <!-- ##################### END COLLECTION PAGE GENERATION ################# -->
0111 
0112 
0113 <!-- ##################### IMAGE PAGINATION LINK GENERATATION ############# -->
0114 <xsl:template name="image.pagination">
0115 <xsl:param name="indexPage" />
0116 <div class="detailNav">
0117   <ul>
0118     <xsl:variable name="pos" select="1 + count(preceding-sibling::image)" />
0119     <xsl:variable name="numImages" select="1 + count(preceding-sibling::image) + count(following-sibling::image)" />
0120     <xsl:choose>
0121       <xsl:when test="$pos &gt; 1">
0122         <li class="previous">
0123           <a href="{preceding-sibling::image[1]/full/@fileName}.html">
0124             <xsl:value-of select="$i18nPrevious" />
0125           </a>
0126         </li>
0127       </xsl:when>
0128       <xsl:otherwise>
0129         <li class="previous">
0130           <xsl:value-of select="$i18nPrevious" />
0131         </li>
0132       </xsl:otherwise>
0133     </xsl:choose>
0134         
0135         
0136     <li class="index">
0137       <a href="../{$indexPage}"><xsl:value-of select="../name" /></a>
0138     </li>
0139     
0140     <xsl:choose>
0141       <xsl:when test="$pos &lt; $numImages">
0142         <li class="previous">
0143           <a href="{following-sibling::image[1]/full/@fileName}.html">
0144             <xsl:value-of select="$i18nNext" />
0145           </a>
0146         </li>
0147       </xsl:when>
0148       <xsl:otherwise>
0149         <li class="previous">
0150           <xsl:value-of select="$i18nNext" />
0151         </li>
0152       </xsl:otherwise>
0153     </xsl:choose>
0154   </ul>
0155 </div>
0156 </xsl:template>
0157 
0158 
0159 <!-- ##################### PAGINATION LINK GENERATATION ################### -->
0160 <xsl:template name="pagination">
0161   <xsl:param name="numPages" />
0162   <xsl:param name="pageNum" />
0163   <xsl:if test="$numPages &gt; 1">
0164 
0165     <div class="clear"></div>
0166     <div class="pagination">
0167       <ul>
0168       
0169         <xsl:call-template name="pagination.for.loop">
0170           <xsl:with-param name="i" select="0" />
0171           <xsl:with-param name="count" select="$numPages" />
0172           <xsl:with-param name="currentPage" select="$pageNum" />
0173         </xsl:call-template>
0174 
0175         <xsl:choose>
0176           <xsl:when test="number($pageNum) = 0">
0177             <li class="previous"><xsl:value-of select="$i18nPrevious" /></li>
0178           </xsl:when>
0179           <xsl:otherwise>
0180             <li class="previous">
0181               <a class="paginationLinks">
0182                 <xsl:attribute name="href">
0183                   <xsl:call-template name="pageLink">
0184                     <xsl:with-param name="collectionFilename" select="fileName" />
0185                     <xsl:with-param name="pageNum" select="number($pageNum)-1" />
0186                   </xsl:call-template>
0187                 </xsl:attribute>
0188                 <xsl:value-of select="$i18nPrevious" />
0189               </a>
0190             </li>
0191           </xsl:otherwise>
0192         </xsl:choose>
0193 
0194         <xsl:choose>
0195           <xsl:when test="number($pageNum) = number($numPages)-1">
0196             <li class="next"><xsl:value-of select="$i18nNext" /></li>
0197           </xsl:when>
0198           <xsl:otherwise>
0199             <li class="next">
0200               <a class="paginationLinks">
0201                 <xsl:attribute name="href">
0202                   <xsl:call-template name="pageLink">
0203                     <xsl:with-param name="collectionFilename" select="fileName" />
0204                     <xsl:with-param name="pageNum" select="number($pageNum)+1" />
0205                   </xsl:call-template>
0206                 </xsl:attribute>
0207                 <xsl:value-of select="$i18nNext" />
0208               </a>
0209             </li>
0210           </xsl:otherwise>
0211         </xsl:choose>
0212       </ul>
0213     </div>
0214 
0215   </xsl:if>
0216 </xsl:template>
0217 
0218 <!-- For loop used to generate pagination links -->
0219 <xsl:template name="pagination.for.loop">
0220   <xsl:param name="i" />
0221   <xsl:param name="count" />
0222   <xsl:param name="currentPage" />
0223   
0224   <xsl:if test="$i &lt; $count">
0225     <xsl:choose>
0226       <xsl:when test="number($currentPage) = $i">
0227         <li class="current"><xsl:value-of select="number($i)+1" /></li>
0228       </xsl:when>
0229       <xsl:otherwise>
0230         <li>
0231           <a>
0232             <xsl:attribute name="href">
0233               <xsl:call-template name="pageLink">
0234                 <xsl:with-param name="collectionFilename" select="fileName" />
0235                 <xsl:with-param name="pageNum" select="$i" />
0236               </xsl:call-template>
0237             </xsl:attribute>
0238             <xsl:value-of select="number($i)+1" />
0239           </a>
0240         </li>
0241       </xsl:otherwise>
0242     </xsl:choose>
0243 
0244     <xsl:call-template name="pagination.for.loop">
0245       <xsl:with-param name="i" select="$i + 1" />
0246       <xsl:with-param name="count" select="$count" />
0247       <xsl:with-param name="currentPage" select="$currentPage" />
0248     </xsl:call-template>
0249   </xsl:if>
0250 </xsl:template>
0251 
0252 <!-- Template which prints out the html url for a particular page -->
0253 <xsl:template name="pageLink">
0254   <xsl:param name="collectionFilename" />
0255   <xsl:param name="pageNum" />
0256   <xsl:choose>
0257     <xsl:when test="($numCollections &gt; 1) and ($pageNum = 0)">
0258       <xsl:value-of select="$collectionFilename" />.html
0259     </xsl:when>
0260     <xsl:when test="($numCollections &lt;= 1) and ($pageNum = 0)">
0261       index.html
0262     </xsl:when>
0263     <xsl:otherwise>
0264       <xsl:value-of select="$collectionFilename" />_<xsl:value-of select="number($pageNum)" />.html
0265     </xsl:otherwise>
0266   </xsl:choose>
0267 </xsl:template>
0268 <!-- ##################### END PAGINATION LINK GENERATATION ############### -->
0269 
0270 
0271 <!-- ##################### SIZING CSS STYLESHEET GENERATATION ############# -->
0272 <xsl:template name="sizingStyle">
0273   <style type='text/css'>
0274     #previewFull {
0275       width: <xsl:value-of select="number(($maxFullWidth + 2*$thumbMargin))" />px !important;
0276     }
0277     
0278     #stage {
0279       width: <xsl:value-of select="number(($maxThumbWidth + 2*$thumbMargin)*$numCols + $numCols + 1)" />px !important;
0280     }
0281     
0282     .thumbnail {
0283       width: <xsl:value-of select="number($maxThumbWidth + 2*$thumbMargin)" />px;
0284       height: <xsl:value-of select="number($maxThumbHeight + 2*$thumbMargin)" />px;
0285     }
0286     
0287     .emptyThumbnail {
0288       width: <xsl:value-of select="number($maxThumbWidth + 2*$thumbMargin)" />px;
0289       height: <xsl:value-of select="number($maxThumbHeight + 2*$thumbMargin)" />px;
0290     }
0291     
0292     #stage2 {
0293       width: <xsl:value-of select="number(($maxFullWidth + 2*$thumbMargin) + 2)" />px !important;
0294     }
0295     
0296     #wrapper {
0297       width: <xsl:value-of select="number(($maxThumbWidth + 2*$thumbMargin)*$numCols + $numCols + 1)" />px !important;
0298     }
0299     
0300     #wrapper2 {
0301       width: <xsl:value-of select="number(($maxFullWidth + 2*$thumbMargin) + 2)" />px !important;
0302     }
0303 
0304     .itemNumber {
0305       display: <xsl:value-of select="$displayNumbers" /> !important;
0306     }
0307   </style>
0308 </xsl:template>
0309 <!-- ##################### END SIZING CSS STYLESHEET GENERATATION ######### -->
0310 
0311 
0312 <!-- ##################### LYTEBOX CONFIG GENERATION ###################### -->
0313 <!--
0314   Adds some javascript that sets the lytebox parameters and initializes 
0315   lytebox when the page loads.
0316 -->
0317 <xsl:template name="lyteboxConfig">
0318 <script type="text/javascript">
0319   function initLytebox() { myLytebox = new LyteBox('<xsl:value-of select="$theme" />',
0320                                                    <xsl:value-of select="$outerBorder" />,
0321                                                    <xsl:value-of select="$resizeSpeed" />,
0322                                                    <xsl:value-of select="$maxOpacity" />,
0323                                                    <xsl:value-of select="$navType" />,
0324                                                    <xsl:value-of select="$autoResize" />,
0325                                                    <xsl:value-of select="$doAnimations" />,
0326                                                    <xsl:value-of select="$slideInterval" />,
0327                                                    <xsl:value-of select="$showNavigation" />); }
0328   if (window.addEventListener) {
0329       window.addEventListener("load",initLytebox,false);
0330   } else if (window.attachEvent) {
0331       window.attachEvent("onload",initLytebox);
0332   } else {
0333       window.onload = function() {initLytebox();}
0334   }
0335 </script>
0336 </xsl:template>
0337 <!-- ##################### END LYTEBOX CONFIG GENERATION ################## -->
0338 
0339 
0340 <!-- ##################### COLLECTION PAGE GENERATION ##################### -->
0341 <!--
0342   The collectionPage is a page of thumbnails for a collection.
0343   If there are too many thumbnails to fit on one page then the content is split
0344   up into multiple pages.
0345 -->
0346 <xsl:template name="collectionPage">
0347 <xsl:param name="pageNum" />
0348 <xsl:param name="pageFilename" />
0349 <html>
0350   <head>
0351     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
0352     <meta name="KEYWORDS" content="photography,software,photos,digital darkroom,gallery,image,photographer" />
0353     <meta name="generator" content="DigiKam" />
0354     <title><xsl:value-of select="name" /></title>
0355     <xsl:if test="$useLyteBox = 'true'">
0356       <script type="text/javascript" src="vanilla/resources/js/lytebox.js" />
0357       <xsl:call-template name="lyteboxConfig" />
0358       <link rel="stylesheet" href="vanilla/resources/css/lytebox.css" type="text/css" media="screen" />
0359     </xsl:if>
0360     <link rel="stylesheet" type="text/css" media="screen" href="vanilla/resources/css/master.css" />
0361     <link rel="stylesheet" type="text/css" media="screen">
0362       <xsl:attribute name="href">vanilla/resources/css/<xsl:value-of select="$style" /></xsl:attribute>
0363     </link>
0364     <xsl:call-template name="sizingStyle" />
0365     <xsl:comment><![CDATA[[if lt IE 7.]> <script defer type="text/javascript" src="vanilla/resources/js/pngfix.js"></script> <![endif]]]></xsl:comment>
0366     <xsl:comment><![CDATA[[if gt IE 6]> <link rel="stylesheet" href="vanilla/resources/css/ie7.css"></link> <![endif]]]></xsl:comment>
0367     <xsl:comment><![CDATA[[if lt IE 7.]> <link rel="stylesheet" href="vanilla/resources/css/ie6.css"></link> <![endif]]]></xsl:comment>
0368   </head>
0369   <body>
0370     <div id="wrapper">
0371       <div id="sitetitle">
0372         <h1 id="liveUpdateSiteTitle">
0373           <xsl:if test="$numCollections &gt; 1">
0374             <a href="index.html"><xsl:value-of select="$i18nCollectionList" /></a> ยป
0375           </xsl:if>
0376           <xsl:value-of select="name" />
0377         </h1>
0378       </div>
0379     
0380       <xsl:variable name="numPages" select="ceiling(count(image) div $pageSize)" />
0381       <xsl:variable name="folder" select="fileName"/>
0382       <xsl:variable name="pageName" select="name" />
0383       
0384       <div id="stage">
0385         <div id="index">
0386   
0387           <!-- Add links to all images before the current page. -->
0388           <xsl:if test="$useLyteBox = 'true'">
0389             <xsl:for-each select="image[(position() &lt; ($pageNum * $pageSize) + 1)]">
0390               <xsl:variable name="imageCaption">
0391                 <xsl:value-of select="description" />
0392                 <xsl:if test="original/@fileName != ''">&lt;p&gt;&lt;a href=&quot;<xsl:value-of select='$folder'/>/<xsl:value-of select="original/@fileName" />&quot;&gt;<xsl:value-of select="$i18nOriginalImage" />&lt;/a&gt; (<xsl:value-of select="original/@width" />x<xsl:value-of select="original/@height" />)&lt;/p&gt;</xsl:if>
0393               </xsl:variable>
0394               <a href="{$folder}/{full/@fileName}" rel="lyteshow[{$pageName}]" title="{$imageCaption}"></a>
0395             </xsl:for-each>
0396           </xsl:if>
0397           
0398           <!-- Add thumbnails and links to all images for the current page. -->
0399           <xsl:for-each select="image[(position() &gt;= ($pageNum * $pageSize) + 1) and (position() &lt;= $pageSize + ($pageSize * $pageNum)) and (position() - $pageNum * $pageSize) mod $numCols = 1]">
0400             <xsl:variable name="numCurrentCols" select="count(.|following-sibling::image[position() &lt; $numCols])" />
0401             <xsl:variable name="numColsLeft" select="count(.|following-sibling::image)" />
0402             <xsl:variable name="isLastRow" select="position() mod $numRows = 0 or $numColsLeft &lt;= $numCols" />
0403             <xsl:for-each select=".|following-sibling::image[position() &lt; $numCols]">
0404               <div>
0405                 <xsl:attribute name="class">
0406                   <xsl:choose>
0407                     <xsl:when test="position() = $numCols and $isLastRow">thumbnail borderTopLeft borderRight borderBottom</xsl:when>
0408                     <xsl:when test="$isLastRow">thumbnail borderTopLeft borderBottom</xsl:when>
0409                     <xsl:when test="position() = $numCols">thumbnail borderTopLeft borderRight</xsl:when>
0410                     <xsl:otherwise>thumbnail borderTopLeft</xsl:otherwise>
0411                   </xsl:choose>
0412                 </xsl:attribute>
0413         
0414                 <div class="itemNumber">
0415                   <xsl:value-of select="1 + count(preceding-sibling::image)" />
0416                 </div>
0417                 
0418                 <xsl:choose>
0419                   <xsl:when test="$useLyteBox = 'true'">
0420                     <xsl:variable name="imageCaption">
0421                       <xsl:value-of select="description" />
0422                       <xsl:if test="original/@fileName != ''">&lt;p&gt;&lt;a href=&quot;<xsl:value-of select='$folder'/>/<xsl:value-of select="original/@fileName" />&quot;&gt;<xsl:value-of select="$i18nOriginalImage" />&lt;/a&gt; (<xsl:value-of select="original/@width" />x<xsl:value-of select="original/@height" />)&lt;/p&gt;</xsl:if>
0423                     </xsl:variable>
0424                     
0425                     <div>
0426                     <xsl:attribute name="style">margin-left:<xsl:value-of select="number((($maxThumbWidth + 2*$thumbMargin) - thumbnail/@width) div 2)" />px; margin-top:<xsl:value-of select="number((($maxThumbHeight + 2*$thumbMargin) - thumbnail/@height) div 2)" />px;</xsl:attribute>
0427                       <xsl:choose>
0428                         <xsl:when test="$dropShadow = 'true'">
0429                           <div class="dropShadow">
0430                             <div class="inner">
0431                               <a href="{$folder}/{full/@fileName}" rel="lyteshow[{$pageName}]" title="{$imageCaption}">
0432                                 <img src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" alt="{title}" class="thumb" />
0433                               </a>
0434                             </div>
0435                           </div>
0436                         </xsl:when>
0437                         <xsl:otherwise>
0438                           <a href="{$folder}/{full/@fileName}" rel="lyteshow[{$pageName}]" title="{$imageCaption}">
0439                             <img src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" alt="{title}" class="thumb" />
0440                           </a>
0441                         </xsl:otherwise>
0442                       </xsl:choose>
0443                     </div>
0444                   </xsl:when>
0445                   <xsl:otherwise>
0446                     
0447                     <div>
0448                     <xsl:attribute name="style">margin-left:<xsl:value-of select="number((($maxThumbWidth + 2*$thumbMargin) - thumbnail/@width) div 2)" />px; margin-top:<xsl:value-of select="number((($maxThumbHeight + 2*$thumbMargin) - thumbnail/@height) div 2)" />px;</xsl:attribute>
0449                       <xsl:choose>
0450                         <xsl:when test="$dropShadow = 'true'">
0451                           <div class="dropShadow">
0452                             <div class="inner">
0453                               <a href="{$folder}/{full/@fileName}.html">
0454                                 <img src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" alt="{title}" class="thumb" />
0455                               </a>
0456                             </div>
0457                           </div>
0458                         </xsl:when>
0459                         <xsl:otherwise>
0460                           <a href="{$folder}/{full/@fileName}.html">
0461                             <img src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" alt="{title}" class="thumb" />
0462                           </a>
0463                         </xsl:otherwise>
0464                       </xsl:choose>
0465                     </div>
0466                     <exsl:document href="{$folder}/{full/@fileName}.html"
0467                       method="xml"
0468                       indent="yes" 
0469                       encoding="iso-8859-1" 
0470                       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
0471                       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN">
0472                       <xsl:call-template name="imagePage">
0473                         <xsl:with-param name="indexPage"><xsl:value-of select="$pageFilename" /></xsl:with-param>
0474                       </xsl:call-template>
0475                     </exsl:document>
0476                   </xsl:otherwise>
0477                 </xsl:choose>
0478                 
0479               </div>
0480               <xsl:if test="position() = $numCols">
0481                 <div class="clear"></div>
0482               </xsl:if>
0483               
0484             </xsl:for-each>
0485 
0486             <xsl:call-template name="emptyCell.for.loop">
0487               <xsl:with-param name="i" select="1" />
0488               <xsl:with-param name="count" select="$numCols - $numCurrentCols" />
0489             </xsl:call-template>
0490 
0491           </xsl:for-each>
0492           
0493           <!-- Add links to all images after the current page. -->
0494           <xsl:if test="$useLyteBox = 'true'">
0495             <xsl:for-each select="image[(position() &gt; $pageSize + ($pageSize * $pageNum))]">
0496               <xsl:variable name="imageCaption">
0497                 <xsl:value-of select="description" />
0498                 <xsl:if test="original/@fileName != ''">&lt;p&gt;&lt;a href=&quot;<xsl:value-of select='$folder'/>/<xsl:value-of select="original/@fileName" />&quot;&gt;<xsl:value-of select="$i18nOriginalImage" />&lt;/a&gt; (<xsl:value-of select="original/@width" />x<xsl:value-of select="original/@height" />)&lt;/p&gt;</xsl:if>
0499               </xsl:variable>
0500               <a href="{$folder}/{full/@fileName}" rel="lyteshow[{$pageName}]" title="{$imageCaption}"></a>
0501             </xsl:for-each>
0502           </xsl:if>
0503           
0504         </div>
0505       </div>
0506       
0507       <xsl:call-template name="pagination">
0508         <xsl:with-param name="numPages" select="$numPages" />
0509         <xsl:with-param name="pageNum" select="$pageNum" />
0510       </xsl:call-template>
0511       
0512       <xsl:if test="$author != ''">
0513         <div id="contact">
0514           <a>
0515             <xsl:attribute name="href">mailto:<xsl:value-of select="$authorEmail" /></xsl:attribute>
0516             <span><xsl:value-of select="$author" /></span>
0517           </a>
0518         </div>
0519       </xsl:if>
0520       <div class="clear"></div>
0521     </div>
0522   </body>
0523 </html>
0524 <xsl:if test="$pageNum = 0">
0525   <!-- Generate all subsequent collection pages. -->
0526   <xsl:call-template name="collectionPages" />
0527 </xsl:if>
0528 </xsl:template>
0529 
0530 <!-- For loop used to generate empty thumbnail cells -->
0531 <xsl:template name="emptyCell.for.loop">
0532   <xsl:param name="i" />
0533   <xsl:param name="count" />
0534   
0535   <xsl:if test="$i &lt;= $count">
0536     <div>
0537       <xsl:attribute name="class">
0538         <xsl:choose>
0539           <xsl:when test="$i = $count">emptyThumbnail borderTopLeft borderRight borderBottom</xsl:when>
0540           <xsl:otherwise>emptyThumbnail borderTopLeft borderBottom</xsl:otherwise>
0541         </xsl:choose>
0542       </xsl:attribute>
0543     </div>
0544 
0545     <xsl:call-template name="emptyCell.for.loop">
0546       <xsl:with-param name="i" select="$i + 1" />
0547       <xsl:with-param name="count" select="$count" />
0548     </xsl:call-template>
0549 
0550     <div class="clear"></div>
0551   </xsl:if>
0552 </xsl:template>
0553 <!-- ##################### END COLLECTION PAGE GENERATION ################# -->
0554 
0555 
0556 <!-- ##################### IMAGE PAGE GENERATION ########################## -->
0557 <!--
0558   If lytebox is disabled then a webpage is generated to display the large
0559   version of each image.
0560 -->
0561 <xsl:template name="imagePage">
0562 <xsl:param name="indexPage" />
0563 <html>
0564   <head>
0565     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
0566     <meta name="KEYWORDS" content="photography,software,photos,digital darkroom,gallery,image,photographer" />
0567     <meta name="generator" content="DigiKam" />
0568     <title><xsl:value-of select="title" /></title>
0569     <link rel="stylesheet" type="text/css" media="screen" href="../vanilla/resources/css/master.css" />
0570     <link rel="stylesheet" type="text/css" media="screen">
0571       <xsl:attribute name="href">../vanilla/resources/css/<xsl:value-of select="$style" /></xsl:attribute>
0572     </link>
0573     <xsl:call-template name="sizingStyle" />
0574     <xsl:comment><![CDATA[[if lt IE 7.]> <script defer type="text/javascript" src="../vanilla/resources/js/pngfix.js"></script> <![endif]]]></xsl:comment>
0575     <xsl:comment><![CDATA[[if gt IE 6]> <link rel="stylesheet" href="../vanilla/resources/css/ie7.css"></link> <![endif]]]></xsl:comment>
0576     <xsl:comment><![CDATA[[if lt IE 7.]> <link rel="stylesheet" href="../vanilla/resources/css/ie6.css"></link> <![endif]]]></xsl:comment>
0577   </head>
0578   <body>
0579     <div id="wrapper2">
0580       <div id="sitetitle">
0581         <h1>
0582         <xsl:choose>
0583           <xsl:when test="count(/collections/collection) &gt; 1">
0584             <a href="../index.html"><xsl:value-of select="$i18nCollectionList" /></a>
0585             &#187;
0586             <a href="../{../fileName}.html"><xsl:value-of select="../name" /></a>
0587           </xsl:when>
0588           <xsl:otherwise>
0589             <a href="../index.html"><xsl:value-of select="../name" /></a>
0590           </xsl:otherwise>
0591         </xsl:choose>
0592         </h1>
0593       </div>
0594       <div id="collectionHeader">
0595         <h1>
0596            <xsl:value-of select="title" /> (<xsl:value-of select="1 + count(preceding-sibling::image)" />/<xsl:value-of select="1 + count(preceding-sibling::image) + count(following-sibling::image)" />)
0597         </h1>
0598       </div>
0599       <div id="stage2">
0600         <div id="previewFull" class="borderTopLeft borderBottomRight">
0601         
0602           <xsl:call-template name="image.pagination">
0603             <xsl:with-param name="indexPage" select="$indexPage" />
0604           </xsl:call-template>
0605 
0606           <div>
0607             <xsl:attribute name="style">margin-left:<xsl:value-of select="number((($maxFullWidth + 2*$thumbMargin) - full/@width) div 2)" />px;</xsl:attribute>
0608             <xsl:choose>
0609               <xsl:when test="$dropShadow = 'true'">
0610                 <div class="dropShadow">
0611                   <div class="inner">
0612                     <a href="../{$indexPage}">
0613                       <img src="{full/@fileName}" width="{full/@width}" height="{full/@height}" class="thumb" />
0614                     </a>
0615                   </div>
0616                 </div>
0617               </xsl:when>
0618               <xsl:otherwise>
0619                 <a href="../{$indexPage}">
0620                   <img src="{full/@fileName}" width="{full/@width}" height="{full/@height}" class="thumb" />
0621                 </a>
0622               </xsl:otherwise>
0623             </xsl:choose>
0624             <div style="clear:both;">
0625             </div>
0626           </div>
0627           <div id="detailCaption">
0628             <p><xsl:value-of select="description" /></p>
0629             <xsl:if test="original/@fileName != ''">
0630               <p><a href="{original/@fileName}"><xsl:value-of select="$i18nOriginalImage" /></a>
0631                   (<xsl:value-of select="original/@width" />x<xsl:value-of select="original/@height" />)
0632               </p>
0633             </xsl:if>
0634             <div class="clear"></div>
0635           </div>
0636         </div>
0637       </div>
0638       <div class="clear"></div>
0639       <xsl:if test="$author != ''">
0640         <div id="contact">
0641           <a>
0642             <xsl:attribute name="href">mailto:<xsl:value-of select="$authorEmail" /></xsl:attribute>
0643             <span><xsl:value-of select="$author" /></span>
0644           </a>
0645         </div>
0646       </xsl:if>
0647       <div class="clear"></div>
0648     </div>
0649   </body>
0650 </html>
0651 </xsl:template>
0652 <!-- ##################### END IMAGE PAGE GENERATION ###################### -->
0653 
0654 
0655 <!-- ##################### COLLECTION LIST PAGE GENERATION ################ -->
0656 <!--
0657   If more than one collection was selected for export then a collectionListPage
0658   is generated which provides a list of all the individual collections.
0659 -->
0660 <xsl:template name="collectionListPage">
0661   <html>
0662   <head>
0663     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
0664     <meta name="KEYWORDS" content="photography,software,photos,digital darkroom,gallery,image,photographer" />
0665     <meta name="generator" content="DigiKam" />
0666     <title><xsl:value-of select="$i18nCollectionList" /></title>
0667     <link rel="stylesheet" type="text/css" media="screen" href="vanilla/resources/css/master.css" />
0668     <link rel="stylesheet" type="text/css" media="screen">
0669       <xsl:attribute name="href">vanilla/resources/css/<xsl:value-of select="$style" /></xsl:attribute>
0670     </link>
0671     <xsl:call-template name="sizingStyle" />
0672     <xsl:comment><![CDATA[[if lt IE 7.]> <script defer type="text/javascript" src="vanilla/resources/js/pngfix.js"></script> <![endif]]]></xsl:comment>
0673     <xsl:comment><![CDATA[[if gt IE 6]> <link rel="stylesheet" href="vanilla/resources/css/ie7.css"></link> <![endif]]]></xsl:comment>
0674     <xsl:comment><![CDATA[[if lt IE 7.]> <link rel="stylesheet" href="vanilla/resources/css/ie6.css"></link> <![endif]]]></xsl:comment>
0675   </head>
0676   <body>
0677     <div id="wrapper">
0678       <div id="sitetitle">
0679         <h1 id="liveUpdateSiteTitle">
0680           <xsl:value-of select="$i18nCollectionList" />
0681         </h1>
0682       </div>
0683       
0684       <div id="stage">
0685         <div id="index">
0686           <xsl:for-each select="collections/collection[position() mod $numCols = 1]">
0687             <xsl:variable name="numCurrentCols" select="count(.|following-sibling::collection[position() &lt; $numCols])" />
0688             <xsl:variable name="numColsLeft" select="count(.|following-sibling::collection)" />
0689             <xsl:variable name="isLastRow" select="position() mod $numRows = 0 or $numColsLeft &lt;= $numCols" />
0690             <xsl:for-each select=".|following-sibling::collection[position() &lt; $numCols]">
0691               <div>
0692                 <xsl:attribute name="class">
0693                   <xsl:choose>
0694                     <xsl:when test="position() = $numCols and $isLastRow">thumbnail borderTopLeft borderRight borderBottom</xsl:when>
0695                     <xsl:when test="$isLastRow">thumbnail borderTopLeft borderBottom</xsl:when>
0696                     <xsl:when test="position() = $numCols">thumbnail borderTopLeft borderRight</xsl:when>
0697                     <xsl:otherwise>thumbnail borderTopLeft</xsl:otherwise>
0698                   </xsl:choose>
0699                 </xsl:attribute>
0700                 <xsl:attribute name="style">height:auto;</xsl:attribute>
0701 
0702                 <div class="itemNumber">
0703                   <xsl:value-of select="1 + count(preceding-sibling::collection)" />
0704                 </div>
0705                 
0706                 <xsl:variable name="leftMargin" select="number((($maxThumbWidth + 2*$thumbMargin) - image[1]/thumbnail/@width) div 2)" />
0707                 <xsl:variable name="topMargin" select="number((($maxThumbHeight + 2*$thumbMargin) - image[1]/thumbnail/@height) div 2)" />
0708                 <div>
0709                   <xsl:attribute name="style">margin-left:<xsl:value-of select="$leftMargin" />px; margin-top:<xsl:value-of select="$topMargin" />px;</xsl:attribute>
0710                   <xsl:choose>
0711                     <xsl:when test="$dropShadow = 'true'">
0712                       <div class="dropShadow">
0713                         <div class="inner">
0714                           <a href="{fileName}.html">
0715                             <!-- Use first image as collection image -->
0716                             <img src="{fileName}/{image[1]/thumbnail/@fileName}" width="{image[1]/thumbnail/@width}" height="{image[1]/thumbnail/@height}" alt="{name}" class="thumb" />
0717                           </a>
0718                         </div>
0719                       </div>
0720                     </xsl:when>
0721                     <xsl:otherwise>
0722                       <a href="{fileName}.html">
0723                         <!-- Use first image as collection image -->
0724                         <img src="{fileName}/{image[1]/thumbnail/@fileName}" width="{image[1]/thumbnail/@width}" height="{image[1]/thumbnail/@height}" alt="{name}" class="thumb" />
0725                       </a>
0726                     </xsl:otherwise>
0727                   </xsl:choose>
0728                   <div class="clear"></div>
0729                   <p>
0730                     <xsl:attribute name="style">text-align:center; padding-top: 1ex; margin-left: <xsl:value-of select="-$leftMargin+5" />px; margin-right:5px; height: 3em;</xsl:attribute>
0731                     <a href="{fileName}.html"><xsl:value-of select="name" /></a>
0732                   </p>
0733                 </div>
0734                 <exsl:document href="{fileName}.html"
0735                   method="xml"
0736                   indent="yes" 
0737                   encoding="iso-8859-1" 
0738                   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
0739                   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN">
0740                   <xsl:call-template name="collectionPage">
0741                     <xsl:with-param name="pageFilename"><xsl:value-of select="fileName" />.html</xsl:with-param>
0742                     <xsl:with-param name="pageNum" select="0" />
0743                   </xsl:call-template>
0744                 </exsl:document>
0745                 
0746               </div>
0747               <xsl:if test="position() = $numCols">
0748                 <div class="clear"></div>
0749               </xsl:if>
0750               
0751             </xsl:for-each>
0752 
0753             <xsl:call-template name="emptyCollectionCell.for.loop">
0754               <xsl:with-param name="i" select="1" />
0755               <xsl:with-param name="count" select="$numCols - $numCurrentCols" />
0756             </xsl:call-template>
0757 
0758           </xsl:for-each>
0759         </div>
0760       </div>
0761       
0762       <xsl:if test="$author != ''">
0763         <div id="contact">
0764           <a>
0765             <xsl:attribute name="href">mailto:<xsl:value-of select="$authorEmail" /></xsl:attribute>
0766             <span><xsl:value-of select="$author" /></span>
0767           </a>
0768         </div>
0769       </xsl:if>
0770       <div class="clear"></div>
0771     </div>
0772   </body>
0773 </html>
0774 </xsl:template>
0775 
0776 <!-- For loop used to generate empty collection list page cells -->
0777 <xsl:template name="emptyCollectionCell.for.loop">
0778   <xsl:param name="i" />
0779   <xsl:param name="count" />
0780   
0781   <xsl:if test="$i &lt;= $count">
0782     <div>
0783       <xsl:attribute name="class">
0784         <xsl:choose>
0785           <xsl:when test="$i = $count">emptyThumbnail borderTopLeft borderRight borderBottom</xsl:when>
0786           <xsl:otherwise>emptyThumbnail borderTopLeft borderBottom</xsl:otherwise>
0787         </xsl:choose>
0788       </xsl:attribute>
0789       <xsl:attribute name="style">height:auto;</xsl:attribute>
0790       
0791       <xsl:variable name="leftMargin" select="number((($maxThumbWidth + 2*$thumbMargin) - image[1]/thumbnail/@width) div 2)" />
0792       <xsl:variable name="topMargin" select="number((($maxThumbHeight + 2*$thumbMargin) - image[1]/thumbnail/@height) div 2)" />
0793       <div>
0794         <xsl:attribute name="style">margin-left:<xsl:value-of select="$leftMargin" />px; margin-top:<xsl:value-of select="$topMargin" />px;</xsl:attribute>
0795         <div class="thumb">
0796           <xsl:attribute name="style">border: 0; width:<xsl:value-of select="$maxThumbWidth+2" />px; height:<xsl:value-of select="$maxThumbHeight+2" />px;</xsl:attribute>
0797         </div>
0798         <div class="clear"></div>
0799         <p>
0800           <xsl:attribute name="style">text-align:center; padding-top: 1ex; margin-left: <xsl:value-of select="-$leftMargin+5" />px; margin-right:5px; height: 3em;</xsl:attribute>
0801         </p>
0802       </div>
0803     </div>
0804 
0805     <xsl:call-template name="emptyCollectionCell.for.loop">
0806       <xsl:with-param name="i" select="$i + 1" />
0807       <xsl:with-param name="count" select="$count" />
0808     </xsl:call-template>
0809 
0810     <div class="clear"></div>
0811   </xsl:if>
0812 </xsl:template>
0813 <!-- ##################### END COLLECTION LIST PAGE GENERATION ############ -->
0814 
0815 
0816 <!-- ##################### STARTING POINT ################################# -->
0817 <!--
0818   Determines if we need to create a collectionListPage or just one
0819   collectionPage.
0820 -->
0821 <xsl:template match="/">
0822   <xsl:choose>
0823     <xsl:when test="$numCollections &gt; 1">
0824       <xsl:call-template name="collectionListPage" />
0825     </xsl:when>
0826     <xsl:otherwise>
0827       <xsl:for-each select="collections/collection">
0828         <xsl:call-template name="collectionPage">
0829           <xsl:with-param name="pageFilename">index.html</xsl:with-param>
0830           <xsl:with-param name="pageNum" select="0" />
0831         </xsl:call-template>
0832       </xsl:for-each>
0833     </xsl:otherwise>
0834   </xsl:choose>
0835 </xsl:template>
0836 <!-- ##################### END STARTING POINT ############################# -->
0837 
0838 </xsl:transform>