xml/config.xsl
author František Kučera <franta-hg@frantovo.cz>
Mon, 04 Mar 2019 17:06:42 +0100
branchv_0
changeset 237 7e08730da258
parent 198 03d8492e2ca8
child 249 7655df0622ee
permissions -rw-r--r--
mavenized: jdbc-loopback-driver
franta-hg@119
     1
<?xml version="1.0" encoding="UTF-8"?>
franta-hg@119
     2
<!--
franta-hg@119
     3
SQL-DK
franta-hg@119
     4
Copyright © 2013 František Kučera (frantovo.cz)
franta-hg@119
     5
franta-hg@119
     6
This program is free software: you can redistribute it and/or modify
franta-hg@119
     7
it under the terms of the GNU General Public License as published by
franta-hg@119
     8
the Free Software Foundation, either version 3 of the License, or
franta-hg@119
     9
(at your option) any later version.
franta-hg@119
    10
franta-hg@119
    11
This program is distributed in the hope that it will be useful,
franta-hg@119
    12
but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@119
    13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@119
    14
GNU General Public License for more details.
franta-hg@119
    15
franta-hg@119
    16
You should have received a copy of the GNU General Public License
franta-hg@119
    17
along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@119
    18
-->
franta-hg@119
    19
franta-hg@119
    20
<!--
franta-hg@119
    21
	This XSLT can be used for viewing config files in a web browser (Firefox, rekonq etc.)
franta-hg@119
    22
-->
franta-hg@119
    23
franta-hg@119
    24
<xsl:stylesheet version="1.0"
franta-hg@119
    25
	xmlns="http://www.w3.org/1999/xhtml"
franta-hg@119
    26
	xmlns:h="http://www.w3.org/1999/xhtml"
franta-hg@119
    27
	xmlns:c="https://sql-dk.globalcode.info/xmlns/configuration"
franta-hg@119
    28
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
franta-hg@119
    29
	xmlns:fn="http://www.w3.org/2005/xpath-functions"
franta-hg@119
    30
	xmlns:svg="http://www.w3.org/2000/svg"
franta-hg@119
    31
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
franta-hg@119
    32
	exclude-result-prefixes="fn h p xs">
franta-hg@119
    33
	<xsl:output
franta-hg@119
    34
		method="xml"
franta-hg@119
    35
		indent="yes"
franta-hg@119
    36
		encoding="UTF-8"
franta-hg@119
    37
		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
franta-hg@119
    38
		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
franta-hg@119
    39
		
franta-hg@119
    40
	<xsl:param name="header" select="'SQL-DK configuration'"/>
franta-hg@119
    41
	
franta-hg@119
    42
	<xsl:template match="/">
franta-hg@119
    43
		<html>
franta-hg@119
    44
			<head>
franta-hg@119
    45
				<title><xsl:value-of select="$header"/></title>
franta-hg@119
    46
				<style type="text/css">
franta-hg@119
    47
					body {
franta-hg@119
    48
						font-family: sans;
franta-hg@119
    49
						background-color: #eee;
franta-hg@119
    50
						color: black;
franta-hg@119
    51
						padding-left: 20px;
franta-hg@119
    52
					}
franta-hg@119
    53
					
franta-hg@119
    54
					p {
franta-hg@119
    55
						max-width: 800px;
franta-hg@119
    56
					}
franta-hg@119
    57
					
franta-hg@119
    58
					h1,h2 {
franta-hg@119
    59
						max-width: 800px;
franta-hg@119
    60
						border-radius: 8px;
franta-hg@119
    61
						border: 1px solid #ddd;
franta-hg@119
    62
						background-color: #e8e8e8;
franta-hg@119
    63
						padding: 6px;
franta-hg@119
    64
						text-shadow: 2px 2px 2px #aaa;
franta-hg@119
    65
					}
franta-hg@119
    66
					
franta-hg@119
    67
					h1 {
franta-hg@119
    68
						font-size: 150%
franta-hg@119
    69
					}
franta-hg@119
    70
					
franta-hg@119
    71
					h2 {
franta-hg@119
    72
						font-size: 100%;
franta-hg@119
    73
						font-weight: bold;
franta-hg@119
    74
					}
franta-hg@119
    75
					
franta-hg@119
    76
					table {
franta-hg@119
    77
						border-collapse:collapse;
franta-hg@119
    78
						margin-top: 10px;
franta-hg@119
    79
						margin-bottom: 10px;
franta-hg@119
    80
					}
franta-hg@119
    81
					td, th {
franta-hg@119
    82
						border: 1px solid #ddd;
franta-hg@119
    83
						padding-top: 4px;
franta-hg@119
    84
						padding-bottom: 4px;
franta-hg@119
    85
						padding-left: 6px;
franta-hg@119
    86
						padding-right: 6px;
franta-hg@119
    87
						font-weight: normal;
franta-hg@119
    88
						vertical-align: top;
franta-hg@119
    89
					}
franta-hg@119
    90
					thead tr {
franta-hg@119
    91
						background: #e8e8e8;
franta-hg@119
    92
						color:black;
franta-hg@119
    93
					}
franta-hg@119
    94
					tbody tr:hover {
franta-hg@119
    95
						background-color: #e9e9e9;
franta-hg@119
    96
						color:black;
franta-hg@119
    97
					}
franta-hg@119
    98
					
franta-hg@119
    99
					ul {
franta-hg@119
   100
						margin: 0px;
franta-hg@119
   101
					}
franta-hg@119
   102
					
franta-hg@119
   103
					li {
franta-hg@119
   104
						padding: 0px;
franta-hg@119
   105
					}
franta-hg@198
   106
					
franta-hg@198
   107
					.notes {
franta-hg@198
   108
						font-size: 66%;
franta-hg@198
   109
					}
franta-hg@198
   110
					.notes p {
franta-hg@198
   111
						margin-bottom: 0px;
franta-hg@198
   112
					}
franta-hg@119
   113
				</style>
franta-hg@119
   114
			</head>
franta-hg@119
   115
			<body>
franta-hg@119
   116
				<h1><xsl:value-of select="$header"/></h1>
franta-hg@119
   117
				
franta-hg@119
   118
				<p>
franta-hg@119
   119
					This file defines per-user configuration of <a href="https://sql-dk.globalcode.info/">SQL-DK</a>
franta-hg@119
   120
					– an SQL batch client.
franta-hg@119
   121
				</p>
franta-hg@119
   122
				
franta-hg@119
   123
				
franta-hg@119
   124
				<h2>Database connections</h2>
franta-hg@119
   125
				
franta-hg@119
   126
				<p>This databases are configured:</p>
franta-hg@119
   127
				
franta-hg@119
   128
				<xsl:choose>
franta-hg@119
   129
					<xsl:when test="c:configuration/c:database">
franta-hg@119
   130
						<table>
franta-hg@119
   131
							<thead>
franta-hg@119
   132
								<tr>
franta-hg@119
   133
									<td>name</td>
franta-hg@119
   134
									<td>username</td>
franta-hg@119
   135
									<td>url</td>
franta-hg@198
   136
									<td>JDBC driver</td>
franta-hg@119
   137
									<td>properties</td>
franta-hg@119
   138
								</tr>
franta-hg@119
   139
							</thead>
franta-hg@119
   140
							<tbody>
franta-hg@119
   141
								<xsl:for-each select="c:configuration/c:database">
franta-hg@119
   142
									<tr>
franta-hg@119
   143
									<td><xsl:value-of select="c:name"/></td>
franta-hg@119
   144
									<td><xsl:value-of select="c:userName"/></td>
franta-hg@119
   145
									<td><xsl:value-of select="c:url"/></td>
franta-hg@198
   146
									<td><xsl:value-of select="c:driver"/></td>
franta-hg@119
   147
									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
franta-hg@119
   148
								</tr>
franta-hg@119
   149
								</xsl:for-each>
franta-hg@119
   150
							</tbody>
franta-hg@119
   151
						</table>
franta-hg@119
   152
					</xsl:when>
franta-hg@119
   153
					<xsl:otherwise><p>no databases are configured</p></xsl:otherwise>
franta-hg@119
   154
				</xsl:choose>
franta-hg@119
   155
				
franta-hg@198
   156
				<div class="notes">
franta-hg@198
   157
					<p>Notes:</p>
franta-hg@198
   158
					<ul>
franta-hg@198
   159
						<li>passwords are hidden in this output</li>
franta-hg@198
   160
						<li>JDBC drivers are not mandatory – not needed in SQL-DK, but sometimes useful when <code>jdbc-dk-driver</code> is used in other applications to load SQL-DK's database connections</li>
franta-hg@198
   161
					</ul>
franta-hg@198
   162
				</div>
franta-hg@119
   163
				
franta-hg@119
   164
				
franta-hg@119
   165
				<h2>Output formatters</h2>
franta-hg@119
   166
				
franta-hg@119
   167
				<p>
franta-hg@119
   168
					Default formatter: 
franta-hg@119
   169
					<xsl:choose>
franta-hg@119
   170
						<xsl:when test="c:configuration/c:defaultFormatter"><xsl:value-of select="c:configuration/c:defaultFormatter"/></xsl:when>
franta-hg@119
   171
						<xsl:otherwise>none (built-in default will be used)</xsl:otherwise>
franta-hg@119
   172
					</xsl:choose>
franta-hg@119
   173
				</p>
franta-hg@119
   174
				
franta-hg@119
   175
				<xsl:choose>
franta-hg@119
   176
					<xsl:when test="c:configuration/c:formatter">
franta-hg@119
   177
						<table>
franta-hg@119
   178
							<thead>
franta-hg@119
   179
								<tr>
franta-hg@119
   180
									<td>name</td>
franta-hg@119
   181
									<td>class name</td>
franta-hg@119
   182
									<td>properties</td>
franta-hg@119
   183
								</tr>
franta-hg@119
   184
							</thead>
franta-hg@119
   185
							<tbody>
franta-hg@119
   186
								<xsl:for-each select="c:configuration/c:formatter">
franta-hg@119
   187
									<tr>
franta-hg@119
   188
									<td><xsl:value-of select="c:name"/></td>
franta-hg@119
   189
									<td><xsl:value-of select="c:class"/></td>
franta-hg@119
   190
									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
franta-hg@119
   191
								</tr>
franta-hg@119
   192
								</xsl:for-each>
franta-hg@119
   193
							</tbody>
franta-hg@119
   194
						</table>
franta-hg@119
   195
					</xsl:when>
franta-hg@119
   196
					<xsl:otherwise><p>no additional formatters are defined (built-in defaults will be used)</p></xsl:otherwise>
franta-hg@119
   197
				</xsl:choose>
franta-hg@119
   198
				
franta-hg@119
   199
			</body>
franta-hg@119
   200
		</html>
franta-hg@119
   201
	</xsl:template>
franta-hg@119
   202
	
franta-hg@119
   203
	<xsl:template match="c:property">
franta-hg@119
   204
		<li>
franta-hg@119
   205
			<xsl:value-of select="@name"/> = <xsl:value-of select="."/>
franta-hg@119
   206
		</li>
franta-hg@119
   207
	</xsl:template>
franta-hg@119
   208
franta-hg@119
   209
</xsl:stylesheet>