xml/config.xsl
author František Kučera <franta-hg@frantovo.cz>
Wed, 15 Jan 2014 18:15:55 +0100
branchv_0
changeset 158 770b5009ec42
parent 119 f3e2b95a5f8a
child 198 03d8492e2ca8
permissions -rw-r--r--
InfoLister: print list of available JDBC drivers: --list-jdbc-drivers
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@119
   106
				</style>
franta-hg@119
   107
			</head>
franta-hg@119
   108
			<body>
franta-hg@119
   109
				<h1><xsl:value-of select="$header"/></h1>
franta-hg@119
   110
				
franta-hg@119
   111
				<p>
franta-hg@119
   112
					This file defines per-user configuration of <a href="https://sql-dk.globalcode.info/">SQL-DK</a>
franta-hg@119
   113
					– an SQL batch client.
franta-hg@119
   114
				</p>
franta-hg@119
   115
				
franta-hg@119
   116
				
franta-hg@119
   117
				<h2>Database connections</h2>
franta-hg@119
   118
				
franta-hg@119
   119
				<p>This databases are configured:</p>
franta-hg@119
   120
				
franta-hg@119
   121
				<xsl:choose>
franta-hg@119
   122
					<xsl:when test="c:configuration/c:database">
franta-hg@119
   123
						<table>
franta-hg@119
   124
							<thead>
franta-hg@119
   125
								<tr>
franta-hg@119
   126
									<td>name</td>
franta-hg@119
   127
									<td>username</td>
franta-hg@119
   128
									<td>url</td>
franta-hg@119
   129
									<td>properties</td>
franta-hg@119
   130
								</tr>
franta-hg@119
   131
							</thead>
franta-hg@119
   132
							<tbody>
franta-hg@119
   133
								<xsl:for-each select="c:configuration/c:database">
franta-hg@119
   134
									<tr>
franta-hg@119
   135
									<td><xsl:value-of select="c:name"/></td>
franta-hg@119
   136
									<td><xsl:value-of select="c:userName"/></td>
franta-hg@119
   137
									<td><xsl:value-of select="c:url"/></td>
franta-hg@119
   138
									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
franta-hg@119
   139
								</tr>
franta-hg@119
   140
								</xsl:for-each>
franta-hg@119
   141
							</tbody>
franta-hg@119
   142
						</table>
franta-hg@119
   143
					</xsl:when>
franta-hg@119
   144
					<xsl:otherwise><p>no databases are configured</p></xsl:otherwise>
franta-hg@119
   145
				</xsl:choose>
franta-hg@119
   146
				
franta-hg@119
   147
				<p>(passwords are hidden in this output)</p>
franta-hg@119
   148
				
franta-hg@119
   149
				
franta-hg@119
   150
				<h2>Output formatters</h2>
franta-hg@119
   151
				
franta-hg@119
   152
				<p>
franta-hg@119
   153
					Default formatter: 
franta-hg@119
   154
					<xsl:choose>
franta-hg@119
   155
						<xsl:when test="c:configuration/c:defaultFormatter"><xsl:value-of select="c:configuration/c:defaultFormatter"/></xsl:when>
franta-hg@119
   156
						<xsl:otherwise>none (built-in default will be used)</xsl:otherwise>
franta-hg@119
   157
					</xsl:choose>
franta-hg@119
   158
				</p>
franta-hg@119
   159
				
franta-hg@119
   160
				<xsl:choose>
franta-hg@119
   161
					<xsl:when test="c:configuration/c:formatter">
franta-hg@119
   162
						<table>
franta-hg@119
   163
							<thead>
franta-hg@119
   164
								<tr>
franta-hg@119
   165
									<td>name</td>
franta-hg@119
   166
									<td>class name</td>
franta-hg@119
   167
									<td>properties</td>
franta-hg@119
   168
								</tr>
franta-hg@119
   169
							</thead>
franta-hg@119
   170
							<tbody>
franta-hg@119
   171
								<xsl:for-each select="c:configuration/c:formatter">
franta-hg@119
   172
									<tr>
franta-hg@119
   173
									<td><xsl:value-of select="c:name"/></td>
franta-hg@119
   174
									<td><xsl:value-of select="c:class"/></td>
franta-hg@119
   175
									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
franta-hg@119
   176
								</tr>
franta-hg@119
   177
								</xsl:for-each>
franta-hg@119
   178
							</tbody>
franta-hg@119
   179
						</table>
franta-hg@119
   180
					</xsl:when>
franta-hg@119
   181
					<xsl:otherwise><p>no additional formatters are defined (built-in defaults will be used)</p></xsl:otherwise>
franta-hg@119
   182
				</xsl:choose>
franta-hg@119
   183
				
franta-hg@119
   184
			</body>
franta-hg@119
   185
		</html>
franta-hg@119
   186
	</xsl:template>
franta-hg@119
   187
	
franta-hg@119
   188
	<xsl:template match="c:property">
franta-hg@119
   189
		<li>
franta-hg@119
   190
			<xsl:value-of select="@name"/> = <xsl:value-of select="."/>
franta-hg@119
   191
		</li>
franta-hg@119
   192
	</xsl:template>
franta-hg@119
   193
franta-hg@119
   194
</xsl:stylesheet>