Revision 87:25dec6931f18, 1.5 KB
(checked in by František Kučera <franta-hg@…>, 13 years ago)
|
Lepší odsazení, tabulátory.
|
Line | |
---|
1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <xsl:stylesheet version="2.0" |
---|
3 | xmlns="http://www.w3.org/1999/xhtml" |
---|
4 | xmlns:h="http://www.w3.org/1999/xhtml" |
---|
5 | xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana" |
---|
6 | xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace" |
---|
7 | xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" |
---|
8 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
9 | xmlns:fn="http://www.w3.org/2005/xpath-functions" |
---|
10 | xmlns:svg="http://www.w3.org/2000/svg" |
---|
11 | xmlns:xs="http://www.w3.org/2001/XMLSchema" |
---|
12 | exclude-result-prefixes="fn h s k m xs"> |
---|
13 | |
---|
14 | <!-- Ukázka vlastního „makra“: --> |
---|
15 | <xsl:template match="m:měřák"> |
---|
16 | <xsl:variable name="hodnota" select="number(@hodnota)"/> |
---|
17 | <xsl:variable name="šířkaGrafu" select="128"/> |
---|
18 | <xsl:choose> |
---|
19 | <xsl:when test="$hodnota >= 0 and $hodnota <= 100"> |
---|
20 | <div style="border: 1px solid black; width: {$šířkaGrafu}px; height: 16px; padding: 0px; text-align: center; background-color: #cfc;"> |
---|
21 | <div style="margin: 0px; background-color: #A4E666; width: {@hodnota*$šířkaGrafu div 100}px; height: 16px;"><xsl:call-template name="varováníRetardace"/></div> |
---|
22 | <p style="margin: 0px; font-size: 12px; position: relative; top: -15px;"> |
---|
23 | <xsl:value-of select="@hodnota"/>/100 |
---|
24 | </p> |
---|
25 | </div> |
---|
26 | </xsl:when> |
---|
27 | <xsl:otherwise> |
---|
28 | <xsl:message terminate="yes">Hodnota měřáku musí být nejméně 0 a nejvíce 100 (udává procenta).</xsl:message> |
---|
29 | </xsl:otherwise> |
---|
30 | </xsl:choose> |
---|
31 | </xsl:template> |
---|
32 | |
---|
33 | </xsl:stylesheet> |
---|