1 <?xml version='1.0' encoding='UTF-8' ?>
3 Nick's web site: Image description page formatter
5 Copyright © 2020 Nick Bowler
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>
20 <xsl:stylesheet version='1.0'
21 xmlns='http://www.w3.org/1999/xhtml'
22 xmlns:xhtml='http://www.w3.org/1999/xhtml'
23 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
24 exclude-result-prefixes='xhtml'>
26 <xsl:output method='xml' encoding='UTF-8' indent='yes'
27 omit-xml-declaration='yes' />
29 <xsl:template match='node()|@*'>
30 <xsl:copy><xsl:apply-templates select='node()|@*' /></xsl:copy>
33 <xsl:template name='exif'>
34 <xsl:param name='node' select='.' />
35 <xsl:param name='name' select='local-name($node)' />
38 <td><xsl:value-of select='$name' /></td>
39 <td><xsl:value-of select='$node' /></td>
42 <xsl:template match='exif'>
46 <tr><th>Attribute</th><th>Value</th></tr>
49 <xsl:call-template name='exif'>
50 <xsl:with-param name='node' select='make' />
51 <xsl:with-param name='name' select='"Camera make"' />
53 <xsl:call-template name='exif'>
54 <xsl:with-param name='node' select='model' />
55 <xsl:with-param name='name' select='"Camera model"' />
57 <xsl:call-template name='exif'>
58 <xsl:with-param name='node' select='date_time_original' />
59 <xsl:with-param name='name' select='"Date taken"' />
61 <xsl:call-template name='exif'>
62 <xsl:with-param name='node' select='concat(exposure_time, "s")' />
63 <xsl:with-param name='name' select='"Shutter speed"' />
65 <xsl:call-template name='exif'>
66 <xsl:with-param name='node' select='concat("f/", f_number)' />
67 <xsl:with-param name='name' select='"Aperture"' />
69 <xsl:call-template name='exif'>
70 <xsl:with-param name='node' select='exposure_bias_value' />
71 <xsl:with-param name='name' select='"Exposure compensation"' />
73 <xsl:call-template name='exif'>
74 <xsl:with-param name='node' select='concat(focal_length, "mm")' />
75 <xsl:with-param name='name' select='"Focal length"' />
77 <xsl:call-template name='exif'>
78 <xsl:with-param name='node' select='flash' />
79 <xsl:with-param name='name' select='"Flash"' />
81 <xsl:call-template name='exif'>
82 <xsl:with-param name='node' select='iso_speed_ratings' />
83 <xsl:with-param name='name' select='"ISO speed rating"' />
85 <xsl:call-template name='exif'>
86 <xsl:with-param name='node' select='exposure_program' />
87 <xsl:with-param name='name' select='"Exposure program"' />
89 <xsl:call-template name='exif'>
90 <xsl:with-param name='node' select='metering_mode' />
91 <xsl:with-param name='name' select='"Metering mode"' />
97 <xsl:template match='variant'>
101 select='concat(name, " (", width, "x", height, ", ", filesize, ")")' />
106 <xsl:template match='xhtml:description'>
107 <h2 id='desc'>Description</h2>
110 <xsl:apply-templates select='node()' />
113 <p><xsl:apply-templates select='node()' /></p>
118 <xsl:template match='/'>
120 <img src='{/image/variant[1]/uri}' alt=''
121 width='{/image/variant[1]/width}'
122 height='{/image/variant[1]/height}'>
123 <xsl:if test='/image/xhtml:description'>
124 <xsl:attribute name='longdesc'>#desc</xsl:attribute>
128 <xsl:apply-templates select='/image/xhtml:description' />
131 <xsl:apply-templates select='/image/variant'>
132 <xsl:sort select='width*height' order='ascending' data-type='number' />
133 </xsl:apply-templates>
135 <xsl:apply-templates select='/image/exif' />