vstup/makra/měřák.xsl
changeset 51 df1f942f7b69
parent 19 b81b96475fe0
child 87 25dec6931f18
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/vstup/makra/měřák.xsl	Fri Jan 06 20:48:42 2012 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<xsl:stylesheet version="2.0"
     1.6 +	xmlns="http://www.w3.org/1999/xhtml"
     1.7 +	xmlns:h="http://www.w3.org/1999/xhtml"
     1.8 +	xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
     1.9 +	xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
    1.10 +	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
    1.11 +	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    1.12 +	xmlns:fn="http://www.w3.org/2005/xpath-functions"
    1.13 +	xmlns:svg="http://www.w3.org/2000/svg"
    1.14 +	xmlns:xs="http://www.w3.org/2001/XMLSchema"
    1.15 +	exclude-result-prefixes="fn h s k m xs">
    1.16 +    
    1.17 +    <!-- Ukázka vlastního „makra“: -->
    1.18 +    <xsl:template match="m:měřák">
    1.19 +    	<xsl:variable name="hodnota" select="number(@hodnota)"/>
    1.20 +    	<xsl:variable name="šířkaGrafu" select="128"/>
    1.21 +		<xsl:choose>			
    1.22 +			<xsl:when test="$hodnota &gt;= 0 and $hodnota &lt;= 100">				
    1.23 +				<div style="border: 1px solid black; width: {$šířkaGrafu}px; height: 16px; padding: 0px; text-align: center; background-color: #cfc;">			
    1.24 +					<div style="margin: 0px; background-color: #A4E666; width: {@hodnota*$šířkaGrafu div 100}px; height: 16px;"><xsl:call-template name="varováníRetardace"/></div>
    1.25 +					<p style="margin: 0px; font-size: 12px; position: relative; top: -15px;">
    1.26 +						<xsl:value-of select="@hodnota"/>/100
    1.27 +					</p>	
    1.28 +				</div>
    1.29 +			</xsl:when>
    1.30 +			<xsl:otherwise>
    1.31 +				<xsl:message terminate="yes">Hodnota měřáku musí být nejméně 0 a nejvíce 100 (udává procenta).</xsl:message>
    1.32 +			</xsl:otherwise>
    1.33 +		</xsl:choose>
    1.34 +	</xsl:template>
    1.35 +
    1.36 +</xsl:stylesheet>
    1.37 \ No newline at end of file