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