4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<link rel="STYLESHEET" type="text/css" href="pgadmin3.css">
6
<title>Výchozí styl XSL</title>
11
<h3>Výchozí styl XSL</h3>
14
Na ukázku a jako výchozí bod pro vaše vlastní styly je zde uveden styl zabudovaný v pgAdminu. pgAdmin jej
15
využívá k vytváření reportu v XHTML z dat XML daného reportu. Obsahuje výchozí HTML styl, který se vloží do reportu
16
tak, aby měl vzhled a formu typické pro pgAdmin.
19
<pre style="background-color: #dddddd;">
20
<?xml version="1.0"?>
21
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
22
<xsl:output method="xml" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" indent="yes" encoding="utf-8" />
23
<xsl:template match="/report">
27
<xsl:if test="header/title != ''">
28
<title><xsl:value-of select="header/title" /></title>
30
<meta http-equiv="Content-Type" content="utf-8" />
31
<style type="text/css">
32
body { font-family: verdana, helvetica, sans-serif; margin: 0px; padding: 0; }
33
h1 { font-weight: bold; font-size: 150%; border-bottom-style: solid; border-bottom-width: 2px; margin-top: 0px; padding-bottom: 0.5ex; color: #eeeeee; }
34
h2 { font-size: 130%; padding-bottom: 0.5ex; color: #009ace; border-bottom-style: solid; border-bottom-width: 2px; }
35
h3 { font-size: 110%; padding-bottom: 0.5ex; color: #000000; }
36
th { text-align: left; background-color: #009ace; color: #eeeeee; }
37
#ReportHeader { padding: 10px; background-color: #009ace; color: #eeeeee; border-bottom-style: solid; border-bottom-width: 2px; border-color: #999999; }
38
#ReportHeader th { width: 25%; white-space: nowrap; vertical-align: top; }
39
#ReportHeader td { vertical-align: top; color: #eeeeee; }
40
#ReportNotes { padding: 10px; background-color: #eeeeee; font-size: 80%; border-bottom-style: solid; border-bottom-width: 2px; border-color: #999999; }
41
.ReportSQL { margin-bottom: 10px; padding: 10px; display: block; background-color: #eeeeee; font-family: monospace; }
42
#ReportDetails { margin-left: 10px; margin-right: 10px; margin-bottom: 10px; }
43
#ReportDetails td, th { font-size: 80%; margin-left: 2px; margin-right: 2px; }
44
#ReportDetails th { border-bottom-color: #777777; border-bottom-style: solid; border-bottom-width: 2px; }
45
.ReportDetailsOddDataRow { background-color: #dddddd; }
46
.ReportDetailsEvenDataRow { background-color: #eeeeee; }
47
.ReportTableHeaderCell { background-color: #dddddd; color: #009ace; vertical-align: top; font-size: 80%; white-space: nowrap; }
48
.ReportTableValueCell { vertical-align: top; font-size: 80%; white-space: nowrap; }
49
.ReportTableInfo { font-size: 80%; font-style: italic; }
50
#ReportFooter { font-weight: bold; font-size: 80%; text-align: right; background-color: #009ace; color: #eeeeee; margin-top: 10px; padding: 2px; border-bottom-style: solid; border-bottom-width: 2px; border-top-style: solid; border-top-width: 2px; border-color: #999999; }
51
#ReportFooter a { color: #ffffff; text-decoration: none; }
56
<div id="ReportHeader">
58
<xsl:if test="header/title != ''">
59
<h1><xsl:value-of select="header/title" /></h1>
62
<xsl:if test="header/generated != ''">
63
<b>Generated: </b><xsl:value-of select="header/generated" /><br />
66
<xsl:if test="header/server != ''">
67
<b>Server: </b><xsl:value-of select="header/server" /><br />
70
<xsl:if test="header/database != ''">
71
<b>Database: </b><xsl:value-of select="header/database" /><br />
74
<xsl:if test="header/catalog != ''">
75
<b>Catalog: </b><xsl:value-of select="header/catalog" /><br />
78
<xsl:if test="header/schema != ''">
79
<b>Schema: </b><xsl:value-of select="header/schema" /><br />
82
<xsl:if test="header/table != ''">
83
<b>Table: </b><xsl:value-of select="header/table" /><br />
86
<xsl:if test="header/job != ''">
87
<b>Job: </b><xsl:value-of select="header/job" /><br />
92
<xsl:if test="header/notes != ''">
93
<div id="ReportNotes">
94
<b>Notes: </b><br /><br />
95
<xsl:call-template name="substitute">
96
<xsl:with-param name="string" select="header/notes" />
97
</xsl:call-template>
101
<div id="ReportDetails">
102
<xsl:apply-templates select="section" >
103
<xsl:sort select="@number" data-type="number" order="ascending" />
104
</xsl:apply-templates>
107
<div id="ReportFooter">
108
Report generated by <a href="http://www.pgadmin.org/">pgAdmin</a>
115
</xsl:template>
117
<xsl:template match="section">
118
<xsl:if test="../section[@id = current()/@id]/@name != ''">
119
<h2><xsl:value-of select="../section[@id = current()/@id]/@name" /></h2>
122
<xsl:if test="count(../section[@id = current()/@id]/table/columns/column) > 0">
125
<xsl:apply-templates select="../section[@id = current()/@id]/table/columns/column">
126
<xsl:sort select="@number" data-type="number" order="ascending" />
127
<xsl:with-param name="count" select="count(../section[@id = current()/@id]/table/columns/column)" />
128
</xsl:apply-templates>
130
<xsl:apply-templates select="../section[@id = current()/@id]/table/rows/*" mode="rows">
131
<xsl:sort select="@number" data-type="number" order="ascending" />
132
<xsl:with-param name="column-meta" select="../section[@id = current()/@id]/table/columns/column" />
133
</xsl:apply-templates>
136
<xsl:if test="../section[@id = current()/@id]/table/info != ''">
137
<p class="ReportTableInfo"><xsl:value-of select="../section[@id = current()/@id]/table/info" /></p>
141
<xsl:if test="../section[@id = current()/@id]/sql != ''">
142
<pre class="ReportSQL">
143
<xsl:call-template name="substitute">
144
<xsl:with-param name="string" select="../section[@id = current()/@id]/sql" />
145
</xsl:call-template>
148
</xsl:template>
150
<xsl:template match="column">
151
<xsl:param name="count" />
152
<th class="ReportTableHeaderCell">
153
<xsl:attribute name="width"><xsl:value-of select="100 div $count" />%</xsl:attribute>
154
<xsl:call-template name="substitute">
155
<xsl:with-param name="string" select="@name" />
156
</xsl:call-template>
158
</xsl:template>
160
<xsl:template match="*" mode="rows">
161
<xsl:param name="column-meta" />
164
<xsl:when test="position() mod 2 != 1">
165
<xsl:attribute name="class">ReportDetailsOddDataRow</xsl:attribute>
167
<xsl:otherwise>
168
<xsl:attribute name="class">ReportDetailsEvenDataRow</xsl:attribute>
169
</xsl:otherwise>
170
</xsl:choose>
171
<xsl:apply-templates select="$column-meta" mode="cells">
172
<xsl:with-param name="row" select="." />
173
</xsl:apply-templates>
175
</xsl:template>
177
<xsl:template match="*" mode="cells">
178
<xsl:param name="row" />
179
<td class="ReportTableValueCell">
181
<xsl:when test="$row/@*[name() = current()/@id]|$row/*[name() = current()/@id] != ''">
182
<xsl:call-template name="substitute">
183
<xsl:with-param name="string" select="$row/@*[name() = current()/@id]|$row/*[name() = current()/@id]" />
184
</xsl:call-template>
186
<xsl:otherwise>
187
<xsl:text> </xsl:text>
188
</xsl:otherwise>
189
</xsl:choose>
191
</xsl:template>
193
<xsl:template name="substitute">
194
<xsl:param name="string" />
195
<xsl:param name="from" select="'&#xA;'" />
196
<xsl:param name="to">
200
<xsl:when test="contains($string, $from)">
201
<xsl:value-of select="substring-before($string, $from)" />
202
<xsl:copy-of select="$to" />
203
<xsl:call-template name="substitute">
204
<xsl:with-param name="string" select="substring-after($string, $from)" />
205
<xsl:with-param name="from" select="$from" />
206
<xsl:with-param name="to" select="$to" />
207
</xsl:call-template>
209
<xsl:otherwise>
210
<xsl:value-of select="$string" />
211
</xsl:otherwise>
212
</xsl:choose>
213
</xsl:template>
215
</xsl:stylesheet>