+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ Nick's web site: Image description page formatter
+
+ Copyright © 2020 Nick Bowler
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>
+-->
+<xsl:stylesheet version='1.0'
+ xmlns='http://www.w3.org/1999/xhtml'
+ xmlns:xhtml='http://www.w3.org/1999/xhtml'
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+ exclude-result-prefixes='xhtml'>
+
+<xsl:output method='xml' encoding='UTF-8' indent='yes'
+ omit-xml-declaration='yes' />
+
+<xsl:template match='node()|@*'>
+ <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
+</xsl:template>
+
+<xsl:template name='exif'>
+ <xsl:param name='node' select='.' />
+ <xsl:param name='name' select='local-name($node)' />
+
+ <tr>
+ <td><xsl:value-of select='$name' /></td>
+ <td><xsl:value-of select='$node' /></td>
+ </tr>
+</xsl:template>
+<xsl:template match='exif'>
+ <h2>Metadata</h2>
+ <table>
+ <thead>
+ <tr><th>Attribute</th><th>Value</th></tr>
+ </thead>
+ <tbody>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='make' />
+ <xsl:with-param name='name' select='"Camera make"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='model' />
+ <xsl:with-param name='name' select='"Camera model"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='date_time_original' />
+ <xsl:with-param name='name' select='"Date taken"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='concat(exposure_time, "s")' />
+ <xsl:with-param name='name' select='"Shutter speed"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='concat("f/", f_number)' />
+ <xsl:with-param name='name' select='"Aperture"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='exposure_bias_value' />
+ <xsl:with-param name='name' select='"Exposure compensation"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='concat(focal_length, "mm")' />
+ <xsl:with-param name='name' select='"Focal length"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='flash' />
+ <xsl:with-param name='name' select='"Flash"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='iso_speed_ratings' />
+ <xsl:with-param name='name' select='"ISO speed rating"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='exposure_program' />
+ <xsl:with-param name='name' select='"Exposure program"' />
+ </xsl:call-template>
+ <xsl:call-template name='exif'>
+ <xsl:with-param name='node' select='metering_mode' />
+ <xsl:with-param name='name' select='"Metering mode"' />
+ </xsl:call-template>
+ </tbody>
+ </table>
+</xsl:template>
+
+<xsl:template match='variant'>
+ <li>
+ <a href='{uri}'>
+ <xsl:value-of
+ select='concat(name, " (", width, "x", height, ", ", filesize, ")")' />
+ </a>
+ </li>
+</xsl:template>
+
+<xsl:template match='xhtml:description'>
+ <h2 id='desc'>Description</h2>
+ <xsl:choose>
+ <xsl:when test='*'>
+ <xsl:apply-templates select='node()' />
+ </xsl:when>
+ <xsl:otherwise>
+ <p><xsl:apply-templates select='node()' /></p>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match='/'>
+ <p>
+ <img src='{/image/variant[1]/uri}' alt=''
+ width='{/image/variant[1]/width}'
+ height='{/image/variant[1]/height}'>
+ <xsl:if test='/image/xhtml:description'>
+ <xsl:attribute name='longdesc'>#desc</xsl:attribute>
+ </xsl:if>
+ </img>
+ </p>
+ <xsl:apply-templates select='/image/xhtml:description' />
+ <h2>Files</h2>
+ <ul>
+ <xsl:apply-templates select='/image/variant'>
+ <xsl:sort select='width*height' order='ascending' data-type='number' />
+ </xsl:apply-templates>
+ </ul>
+ <xsl:apply-templates select='/image/exif' />
+</xsl:template>
+
+</xsl:stylesheet>