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' mode='exif' match='*'>
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>
43 <xsl:template match='exif'>
47 <tr><th>Attribute</th><th>Value</th></tr>
50 <xsl:apply-templates select='make' mode='exif'>
51 <xsl:with-param name='name' select='"Camera make"' />
52 </xsl:apply-templates>
53 <xsl:apply-templates select='model' mode='exif'>
54 <xsl:with-param name='name' select='"Camera model"' />
55 </xsl:apply-templates>
56 <xsl:apply-templates select='date_time_original' mode='exif'>
57 <xsl:with-param name='name' select='"Date taken"' />
58 </xsl:apply-templates>
59 <xsl:apply-templates select='exposure_time' mode='exif'>
60 <xsl:with-param name='node' select='concat(exposure_time, "s")' />
61 <xsl:with-param name='name' select='"Shutter speed"' />
62 </xsl:apply-templates>
63 <xsl:apply-templates select='f_number' mode='exif'>
64 <xsl:with-param name='node' select='concat("f/", f_number)' />
65 <xsl:with-param name='name' select='"Aperture"' />
66 </xsl:apply-templates>
67 <xsl:apply-templates select='exposure_bias_value' mode='exif'>
68 <xsl:with-param name='name' select='"Exposure compensation"' />
69 </xsl:apply-templates>
70 <xsl:apply-templates select='focal_length' mode='exif'>
71 <xsl:with-param name='node' select='concat(focal_length, "mm")' />
72 <xsl:with-param name='name' select='"Focal length"' />
73 </xsl:apply-templates>
74 <xsl:apply-templates select='flash' mode='exif'>
75 <xsl:with-param name='name' select='"Flash"' />
76 </xsl:apply-templates>
77 <xsl:apply-templates select='iso_speed_ratings' mode='exif'>
78 <xsl:with-param name='name' select='"ISO speed rating"' />
79 </xsl:apply-templates>
80 <xsl:apply-templates select='exposure_program' mode='exif'>
81 <xsl:with-param name='name' select='"Exposure program"' />
82 </xsl:apply-templates>
83 <xsl:apply-templates select='metering_mode' mode='exif'>
84 <xsl:with-param name='name' select='"Metering mode"' />
85 </xsl:apply-templates>
90 <xsl:template match='variant'>
94 select='concat(name, " (", width, "x", height, ", ", filesize, ")")' />
99 <xsl:template match='xhtml:description'>
100 <h2 id='desc'>Description</h2>
103 <xsl:apply-templates select='node()' />
106 <p><xsl:apply-templates select='node()' /></p>
111 <xsl:template match='/'>
113 <img src='{/image/variant[1]/uri}' alt=''
114 width='{/image/variant[1]/width}'
115 height='{/image/variant[1]/height}'>
116 <xsl:if test='/image/xhtml:description'>
117 <xsl:attribute name='longdesc'>#desc</xsl:attribute>
121 <xsl:apply-templates select='/image/xhtml:description' />
124 <xsl:apply-templates select='/image/variant'>
125 <xsl:sort select='width*height' order='ascending' data-type='number' />
126 </xsl:apply-templates>
128 <xsl:apply-templates select='/image/exif' />