xml/config.xsl
branchv_0
changeset 119 f3e2b95a5f8a
child 198 03d8492e2ca8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xml/config.xsl	Thu Jan 02 21:23:23 2014 +0100
     1.3 @@ -0,0 +1,194 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 +SQL-DK
     1.7 +Copyright © 2013 František Kučera (frantovo.cz)
     1.8 +
     1.9 +This program is free software: you can redistribute it and/or modify
    1.10 +it under the terms of the GNU General Public License as published by
    1.11 +the Free Software Foundation, either version 3 of the License, or
    1.12 +(at your option) any later version.
    1.13 +
    1.14 +This program is distributed in the hope that it will be useful,
    1.15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    1.17 +GNU General Public License for more details.
    1.18 +
    1.19 +You should have received a copy of the GNU General Public License
    1.20 +along with this program. If not, see <http://www.gnu.org/licenses/>.
    1.21 +-->
    1.22 +
    1.23 +<!--
    1.24 +	This XSLT can be used for viewing config files in a web browser (Firefox, rekonq etc.)
    1.25 +-->
    1.26 +
    1.27 +<xsl:stylesheet version="1.0"
    1.28 +	xmlns="http://www.w3.org/1999/xhtml"
    1.29 +	xmlns:h="http://www.w3.org/1999/xhtml"
    1.30 +	xmlns:c="https://sql-dk.globalcode.info/xmlns/configuration"
    1.31 +	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    1.32 +	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    1.33 +	xmlns:svg="http://www.w3.org/2000/svg"
    1.34 +	xmlns:xs="http://www.w3.org/2001/XMLSchema"
    1.35 +	exclude-result-prefixes="fn h p xs">
    1.36 +	<xsl:output
    1.37 +		method="xml"
    1.38 +		indent="yes"
    1.39 +		encoding="UTF-8"
    1.40 +		doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 
    1.41 +		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>
    1.42 +		
    1.43 +	<xsl:param name="header" select="'SQL-DK configuration'"/>
    1.44 +	
    1.45 +	<xsl:template match="/">
    1.46 +		<html>
    1.47 +			<head>
    1.48 +				<title><xsl:value-of select="$header"/></title>
    1.49 +				<style type="text/css">
    1.50 +					body {
    1.51 +						font-family: sans;
    1.52 +						background-color: #eee;
    1.53 +						color: black;
    1.54 +						padding-left: 20px;
    1.55 +					}
    1.56 +					
    1.57 +					p {
    1.58 +						max-width: 800px;
    1.59 +					}
    1.60 +					
    1.61 +					h1,h2 {
    1.62 +						max-width: 800px;
    1.63 +						border-radius: 8px;
    1.64 +						border: 1px solid #ddd;
    1.65 +						background-color: #e8e8e8;
    1.66 +						padding: 6px;
    1.67 +						text-shadow: 2px 2px 2px #aaa;
    1.68 +					}
    1.69 +					
    1.70 +					h1 {
    1.71 +						font-size: 150%
    1.72 +					}
    1.73 +					
    1.74 +					h2 {
    1.75 +						font-size: 100%;
    1.76 +						font-weight: bold;
    1.77 +					}
    1.78 +					
    1.79 +					table {
    1.80 +						border-collapse:collapse;
    1.81 +						margin-top: 10px;
    1.82 +						margin-bottom: 10px;
    1.83 +					}
    1.84 +					td, th {
    1.85 +						border: 1px solid #ddd;
    1.86 +						padding-top: 4px;
    1.87 +						padding-bottom: 4px;
    1.88 +						padding-left: 6px;
    1.89 +						padding-right: 6px;
    1.90 +						font-weight: normal;
    1.91 +						vertical-align: top;
    1.92 +					}
    1.93 +					thead tr {
    1.94 +						background: #e8e8e8;
    1.95 +						color:black;
    1.96 +					}
    1.97 +					tbody tr:hover {
    1.98 +						background-color: #e9e9e9;
    1.99 +						color:black;
   1.100 +					}
   1.101 +					
   1.102 +					ul {
   1.103 +						margin: 0px;
   1.104 +					}
   1.105 +					
   1.106 +					li {
   1.107 +						padding: 0px;
   1.108 +					}
   1.109 +				</style>
   1.110 +			</head>
   1.111 +			<body>
   1.112 +				<h1><xsl:value-of select="$header"/></h1>
   1.113 +				
   1.114 +				<p>
   1.115 +					This file defines per-user configuration of <a href="https://sql-dk.globalcode.info/">SQL-DK</a>
   1.116 +					– an SQL batch client.
   1.117 +				</p>
   1.118 +				
   1.119 +				
   1.120 +				<h2>Database connections</h2>
   1.121 +				
   1.122 +				<p>This databases are configured:</p>
   1.123 +				
   1.124 +				<xsl:choose>
   1.125 +					<xsl:when test="c:configuration/c:database">
   1.126 +						<table>
   1.127 +							<thead>
   1.128 +								<tr>
   1.129 +									<td>name</td>
   1.130 +									<td>username</td>
   1.131 +									<td>url</td>
   1.132 +									<td>properties</td>
   1.133 +								</tr>
   1.134 +							</thead>
   1.135 +							<tbody>
   1.136 +								<xsl:for-each select="c:configuration/c:database">
   1.137 +									<tr>
   1.138 +									<td><xsl:value-of select="c:name"/></td>
   1.139 +									<td><xsl:value-of select="c:userName"/></td>
   1.140 +									<td><xsl:value-of select="c:url"/></td>
   1.141 +									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
   1.142 +								</tr>
   1.143 +								</xsl:for-each>
   1.144 +							</tbody>
   1.145 +						</table>
   1.146 +					</xsl:when>
   1.147 +					<xsl:otherwise><p>no databases are configured</p></xsl:otherwise>
   1.148 +				</xsl:choose>
   1.149 +				
   1.150 +				<p>(passwords are hidden in this output)</p>
   1.151 +				
   1.152 +				
   1.153 +				<h2>Output formatters</h2>
   1.154 +				
   1.155 +				<p>
   1.156 +					Default formatter: 
   1.157 +					<xsl:choose>
   1.158 +						<xsl:when test="c:configuration/c:defaultFormatter"><xsl:value-of select="c:configuration/c:defaultFormatter"/></xsl:when>
   1.159 +						<xsl:otherwise>none (built-in default will be used)</xsl:otherwise>
   1.160 +					</xsl:choose>
   1.161 +				</p>
   1.162 +				
   1.163 +				<xsl:choose>
   1.164 +					<xsl:when test="c:configuration/c:formatter">
   1.165 +						<table>
   1.166 +							<thead>
   1.167 +								<tr>
   1.168 +									<td>name</td>
   1.169 +									<td>class name</td>
   1.170 +									<td>properties</td>
   1.171 +								</tr>
   1.172 +							</thead>
   1.173 +							<tbody>
   1.174 +								<xsl:for-each select="c:configuration/c:formatter">
   1.175 +									<tr>
   1.176 +									<td><xsl:value-of select="c:name"/></td>
   1.177 +									<td><xsl:value-of select="c:class"/></td>
   1.178 +									<td><ul><xsl:apply-templates select="c:property"/></ul></td>
   1.179 +								</tr>
   1.180 +								</xsl:for-each>
   1.181 +							</tbody>
   1.182 +						</table>
   1.183 +					</xsl:when>
   1.184 +					<xsl:otherwise><p>no additional formatters are defined (built-in defaults will be used)</p></xsl:otherwise>
   1.185 +				</xsl:choose>
   1.186 +				
   1.187 +			</body>
   1.188 +		</html>
   1.189 +	</xsl:template>
   1.190 +	
   1.191 +	<xsl:template match="c:property">
   1.192 +		<li>
   1.193 +			<xsl:value-of select="@name"/> = <xsl:value-of select="."/>
   1.194 +		</li>
   1.195 +	</xsl:template>
   1.196 +
   1.197 +</xsl:stylesheet>
   1.198 \ No newline at end of file