java/dictionary-generator/concept.xsl
author František Kučera <franta-hg@frantovo.cz>
Tue, 09 Jul 2013 18:59:07 +0200
changeset 15 93208f791318
permissions -rw-r--r--
generator: first version
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <xsl:stylesheet version="1.0"
     3 	xmlns="http://www.w3.org/1999/xhtml"
     4 	xmlns:h="http://www.w3.org/1999/xhtml"
     5 	xmlns:d="https://telco.frantovo.cz/xmlns/dictionary"
     6 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     7 	xmlns:fn="http://www.w3.org/2005/xpath-functions"
     8 	xmlns:xs="http://www.w3.org/2001/XMLSchema"
     9 	exclude-result-prefixes="fn h d xs">
    10 	<xsl:output 
    11 		method="xml" 
    12 		indent="no" 
    13 		encoding="UTF-8"
    14 		omit-xml-declaration="yes"/>
    15 		
    16 	<xsl:param name="tags"/>
    17 	
    18 	<xsl:template match="d:concept">
    19 		<div>
    20 			<!--
    21 				This template should be shortened,
    22 				if used for dictionaries containing many words.
    23 			-->
    24 			<style type="text/css">
    25 			table {
    26 				border-collapse:collapse;
    27 				box-shadow: 3px 3px 3px grey;
    28 				margin-top: 10px;
    29 				margin-bottom: 10px;
    30 			}
    31 			td, th {
    32 				border: 1px solid black;
    33 				padding-top: 4px;
    34 				padding-bottom: 4px;
    35 				padding-left: 6px;
    36 				padding-right: 6px;
    37 				font-weight: normal;
    38 			}
    39 			p.tags {
    40 				font-size: 80%;
    41 			}
    42 			</style>
    43 			<table>
    44 				<tbody>
    45 					<xsl:for-each select="d:term">
    46 						<tr>
    47 							<td><xsl:value-of select="@abbreviation"/></td>
    48 							<td><xsl:value-of select="@completeForm"/></td>
    49 						</tr>
    50 					</xsl:for-each>
    51 				</tbody>
    52 			</table>
    53 			
    54 			<p><xsl:apply-templates select="d:explanation"/></p>
    55 			
    56 			<xsl:if test="d:tag">
    57 			<p class="tags">
    58 				<xsl:text>Tags: </xsl:text>
    59 				<xsl:for-each select="d:tag">
    60 					<xsl:variable name="tagID" select="text()"/>
    61 					<xsl:apply-templates/>
    62 					<!--
    63 					<xsl:value-of select="$tags/d:tag[@id=$tagID]/@name"/>
    64 					-->
    65 					<xsl:if test="not(position() = last())"><xsl:text>, </xsl:text></xsl:if>
    66 				</xsl:for-each>
    67 			</p>
    68 			</xsl:if>
    69 		</div>
    70 	</xsl:template>
    71 
    72 </xsl:stylesheet>