Changeset 10:4e70453a027f for šablona/stránka.xsl
- Timestamp:
- 04/03/11 20:12:33 (13 years ago)
- Branch:
- default
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
šablona/stránka.xsl
r8 r10 14 14 doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" 15 15 doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/> 16 17 <xsl:param name="konfigurák"/> 16 18 17 19 <!-- Celý dokument: --> 18 20 <xsl:template match="/"> 21 <xsl:variable name="konfigurace" select="document($konfigurák)"/> 19 22 <html> 20 23 <head> 21 24 <title><xsl:value-of select="g:stránka/g:nadpis"/></title> 22 25 <link title="Novinky (Atom)" href="atom.xml" type="application/atom+xml" rel="alternate"/> 23 <link title="Novinky (RSS)" href="rss.xml" type="application/rss+xml" rel="alternate"/> 26 <link title="Novinky (RSS)" href="rss.xml" type="application/rss+xml" rel="alternate"/> 27 <xsl:apply-templates select="$konfigurace/g:web/g:js"/> 28 <xsl:apply-templates select="$konfigurace/g:web/g:css"/> 24 29 </head> 25 30 <body> … … 50 55 </xsl:element> 51 56 </xsl:template> 57 58 <xsl:template match="g:web/g:js"> 59 <script src="{text()}" type="text/javascript" /> 60 </xsl:template> 61 <xsl:template match="g:web/g:css"> 62 <link href="{text()}" type="text/css" rel="StyleSheet" /> 63 </xsl:template> 64 65 <!-- Ukázka vlastního „makra“: --> 66 <xsl:template match="g:měřák"> 67 <xsl:variable name="hodnota" select="number(@hodnota)"/> 68 <xsl:variable name="šířkaGrafu" select="128"/> 69 <xsl:choose> 70 <xsl:when test="$hodnota >= 0 and $hodnota <= 100"> 71 <div style="border: 1px solid black; width: {$šířkaGrafu}px; height: 16px; padding: 0px; text-align: center; background-color: #cfc;"> 72 <div style="margin: 0px; background-color: #A4E666; width: {@hodnota*$šířkaGrafu div 100}px; height: 16px;"/> 73 <p style="margin: 0px; font-size: 12px; position: relative; top: -15px;"> 74 <xsl:value-of select="@hodnota"/>/100 75 </p> 76 </div> 77 </xsl:when> 78 <xsl:otherwise> 79 <xsl:message terminate="yes">Hodnota měřáku musí být nejméně 0 a nejvíce 100 (udává procenta).</xsl:message> 80 </xsl:otherwise> 81 </xsl:choose> 82 </xsl:template> 52 83 53 84 </xsl:stylesheet>