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