/usr/share/parley/xslt/table.xsl is in parley-data 4:15.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<!-- XSL Stylesheet to transform kvtml-2 files to html
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
Copyright 2007: Frederik Gladhorn <frederik.gladhorn@kdemail.net>
The easiest way to use the stylesheet is to include it in the .kvtml file:
<?xml-stylesheet type="text/xsl" href="kvtml_html_stylesheet.xsl"?>
-->
<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
encoding="UTF-8" omit-xml-declaration="yes" version="1.0" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
td, th {
border: solid 1px black;
border-collapse: collapse;
}
table {
border: solid 1px black;
border-collapse: collapse;
width: 100%;
}
.comment {
font-style: italic;
}
.firstcolumn {
width: 5%;
}
.contentcell {
width: <xsl:value-of select="95 div count(/kvtml/identifiers/identifier)"/>%;
}
#buttons, #buttons td {
width: auto;
border: none;
}
@media print {
.noprint {
display: none;
}
}
</style>
<script type="text/javascript">
<xsl:text disable-output-escaping="yes"><![CDATA[//<![CDATA[
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.visibility == 'visible')
e.style.visibility = 'hidden';
else
e.style.visibility = 'visible';
}
function set_column_visibility(table, column, visibility) {
if (table == null) {
tables = document.getElementsByTagName("table");
for(var i = 0; i < tables.length; i++) {
if (tables[i].id != "buttons") {
set_column_visibility(tables[i].firstChild, column, visibility);
}
}
return;
}
var tr = table.firstChild;
while (tr != null) {
var td = tr.firstChild;
while (td != null) {
if (td.nodeName == "TD" && td.childNodes.length == 1 && td.childNodes[0].nodeName == "DIV") {
if(column == -1 || td.childNodes[0].id.split("-")[1] == column) {
td.childNodes[0].style.visibility = visibility;
}
}
td = td.nextSibling
}
tr = tr.nextSibling;
}
}
]]>//]]></xsl:text>
</script>
<title><xsl:value-of select="kvtml/information/title"/></title>
</head>
<body><xsl:apply-templates select="kvtml" /></body>
</html>
</xsl:template>
<xsl:template match="kvtml">
<h1><xsl:value-of select="information/title"/></h1>
<table id="buttons" class="noprint">
<xsl:apply-templates select="/kvtml/identifiers" mode="buttons"/>
</table>
<xsl:apply-templates select="lessons"/>
</xsl:template>
<xsl:template match="lessons">
<xsl:apply-templates select="container" mode="toc"/>
<xsl:apply-templates select="container" mode="entries"/>
</xsl:template>
<xsl:template match="container" mode="toc">
<ul class="noprint">
<li>
<a href="#lesson{count(preceding::container) + count(ancestor::container) + 1}"><xsl:value-of select="name"/></a>
<xsl:apply-templates select="container" mode="toc"/>
</li>
</ul>
</xsl:template>
<xsl:template match="container" mode="entries">
<xsl:choose>
<xsl:when test="count(ancestor::container) = 0">
<h2><a name="lesson{count(preceding::container) + count(ancestor::container) + 1}"><xsl:value-of select="name"/></a></h2>
</xsl:when>
<xsl:when test="count(ancestor::container) = 1">
<h3><a name="lesson{count(preceding::container) + count(ancestor::container) + 1}"><xsl:value-of select="name"/></a></h3>
</xsl:when>
<xsl:when test="count(ancestor::container) = 2">
<h4><a name="lesson{count(preceding::container) + count(ancestor::container) + 1}"><xsl:value-of select="name"/></a></h4>
</xsl:when>
<xsl:otherwise>
<h5><a name="lesson{count(preceding::container) + count(ancestor::container) + 1}"><xsl:value-of select="name"/></a></h5>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(child::entry) != 0">
<table>
<tr>
<th></th>
<xsl:apply-templates select="/kvtml/identifiers" mode="header"/>
</tr>
<tr class="noprint">
<td></td>
<xsl:apply-templates select="/kvtml/identifiers" mode="buttonrow"/>
</tr>
<xsl:apply-templates select="entry"/>
<xsl:for-each select="entry">
<xsl:variable name="id" select="@id"/>
<xsl:apply-templates select="/kvtml/entries/entry[@id=$id]"/>
</xsl:for-each>
</table>
</xsl:if>
<xsl:apply-templates select="container" mode="entries"/>
</xsl:template>
<xsl:template match="identifiers/identifier" mode="header">
<th class="numbercell"><xsl:value-of select="name"/></th>
</xsl:template>
<xsl:template match="identifiers/identifier" mode="buttons">
<tr>
<td><xsl:value-of select="name"/>:</td>
<td>
<input type="button" value="Hide all" onclick="set_column_visibility(null, {@id}, 'hidden')" /><xsl:text> </xsl:text>
<input type="button" value="Show all" onclick="set_column_visibility(null, {@id}, 'visible')" />
</td>
</tr>
</xsl:template>
<xsl:template match="identifiers/identifier" mode="buttonrow">
<td>
<input type="button" value="Hide all" onclick="set_column_visibility(this.parentNode.parentNode.parentNode, {@id}, 'hidden')" /><xsl:text> </xsl:text>
<input type="button" value="Show all" onclick="set_column_visibility(this.parentNode.parentNode.parentNode, {@id}, 'visible')" />
</td>
</xsl:template>
<xsl:template match="/kvtml/entries/entry">
<tr><td align="right" class="numbercell"><xsl:value-of select="@id+1" />.</td>
<xsl:apply-templates select="translation"/>
</tr>
</xsl:template>
<xsl:template match="translation">
<td class="contentcell" onclick="toggle_visibility('i{../@id}-{@id}')">
<div id="i{../@id}-{@id}" style="visibility: visible;">
<xsl:value-of select="text"/>
<xsl:apply-templates select="comment"/>
</div>
</td>
</xsl:template>
<xsl:template match="comment">
<span class="comment">
<br/><xsl:value-of select="."/>
</span>
</xsl:template>
</xsl:stylesheet>
|