--- a/šablona/stránka.xsl Thu Jan 05 12:21:53 2012 +0100
+++ b/šablona/stránka.xsl Thu Jan 05 14:49:04 2012 +0100
@@ -214,8 +214,36 @@
<xsl:variable name="prostýText" select="document(concat('http://lipsum.lipsum.com/feed/xml?amount=', @odstavců, '&what=paragraphs'))/feed/lipsum"/>
<xsl:for-each select="fn:tokenize($prostýText, '\n')">
<p><xsl:value-of select="."/></p>
- </xsl:for-each>
+ </xsl:for-each>
</xsl:template>
+ <!--
+ Makro pro jednoduché tabulky
+ -->
+ <xsl:template match="m:tabulka">
+ <table>
+ <xsl:variable name="data" select="replace(replace(text(), '^\s+', ''),'\s+$','')"/>
+ <xsl:variable name="hlavička" select="substring-before($data, ' ')"/>
+ <xsl:variable name="tělo" select="substring-after($data, ' ')"/>
+ <thead>
+ <tr>
+ <xsl:for-each select="tokenize($hlavička, ';')">
+ <td><xsl:value-of select="normalize-space(.)"/></td>
+ </xsl:for-each>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="tokenize($tělo, '\n')">
+ <xsl:if test="normalize-space(.)">
+ <tr>
+ <xsl:for-each select="tokenize(., ';')">
+ <td><xsl:value-of select="normalize-space(.)"/></td>
+ </xsl:for-each>
+ </tr>
+ </xsl:if>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </xsl:template>
</xsl:stylesheet>