-
Notifications
You must be signed in to change notification settings - Fork 1
/
image_metadata_stylesheet.xsl
109 lines (88 loc) · 3.96 KB
/
image_metadata_stylesheet.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes' />
<!-- ************************************************************************* -->
<xsl:variable name="max_images_displayed">30</xsl:variable>
<!-- ************************************************************************* -->
<xsl:template match="/dataset">
<html>
<head>
<style type="text/css">
div#box{
position: absolute;
border-style:solid;
border-width:1px;
border-color:red;
}
div#circle{
position: absolute;
border-style:solid;
border-width:1px;
border-color:red;
border-radius:7px;
width:1px;
height: 1px;
}
div#label{
position: absolute;
color: red;
}
div#img{
position: relative;
margin-bottom:2em;
}
pre {
color: black;
margin: 1em 0.25in;
padding: 0.5em;
background: rgb(240,240,240);
border-top: black dotted 1px;
border-left: black dotted 1px;
border-right: black solid 2px;
border-bottom: black solid 2px;
}
</style>
</head>
<body>
Dataset name: <b><xsl:value-of select='/dataset/name'/></b> <br/>
Dataset comment: <pre><xsl:value-of select='/dataset/comment'/></pre> <br/>
Number of images: <xsl:value-of select="count(images/image)"/> <br/>
Number of boxes: <xsl:value-of select="count(images/image/box)"/> <br/>
<br/>
<hr/>
<!-- Show a warning if we aren't going to show all the images -->
<xsl:if test="count(images/image) > $max_images_displayed">
<h2>Only displaying the first <xsl:value-of select="$max_images_displayed"/> images.</h2>
<hr/>
</xsl:if>
<xsl:for-each select="images/image">
<!-- Don't try to display too many images. It makes your browser hang -->
<xsl:if test="position() <= $max_images_displayed">
<b><xsl:value-of select="@file"/></b> (Number of boxes: <xsl:value-of select="count(box)"/>)
<div id="img">
<img src="{@file}"/>
<xsl:for-each select="box">
<div id="box" style="top: {@top}px; left: {@left}px; width: {@width}px; height: {@height}px;"></div>
<!-- If there is a label then display it in the lower right corner. -->
<xsl:if test="label">
<div id="label" style="top: {@top+@height}px; left: {@left+@width}px;">
<xsl:value-of select="label"/>
</div>
</xsl:if>
<xsl:for-each select="part">
<!--
<div id="label" style="top: {@y+7}px; left: {@x}px;">
<xsl:value-of select="@name"/>
</div>
-->
<div id="circle" style="top: {(@y)}px; left: {(@x)}px; "></div>
</xsl:for-each>
</xsl:for-each>
</div>
</xsl:if>
</xsl:for-each>
</body>
</html>
</xsl:template>
<!-- ************************************************************************* -->
</xsl:stylesheet>