šablona/stránka.xsl
changeset 46 c4ad66b1202e
parent 45 f52b3bb8cfcc
child 49 0be359e4c06f
     1.1 --- a/šablona/stránka.xsl	Thu Jan 05 12:21:53 2012 +0100
     1.2 +++ b/šablona/stránka.xsl	Thu Jan 05 14:49:04 2012 +0100
     1.3 @@ -214,8 +214,36 @@
     1.4      	<xsl:variable name="prostýText" select="document(concat('http://lipsum.lipsum.com/feed/xml?amount=', @odstavců, '&amp;what=paragraphs'))/feed/lipsum"/>
     1.5      	<xsl:for-each select="fn:tokenize($prostýText, '\n')">
     1.6      		<p><xsl:value-of select="."/></p>
     1.7 -    	</xsl:for-each>    	
     1.8 +    	</xsl:for-each>
     1.9      </xsl:template>
    1.10      
    1.11 +    <!--
    1.12 +    	Makro pro jednoduché tabulky
    1.13 +    -->
    1.14 +    <xsl:template match="m:tabulka">
    1.15 +    	<table>
    1.16 +    		<xsl:variable name="data" select="replace(replace(text(), '^\s+', ''),'\s+$','')"/>
    1.17 +    		<xsl:variable name="hlavička" select="substring-before($data, '&#10;')"/>
    1.18 +    		<xsl:variable name="tělo" select="substring-after($data, '&#10;')"/>
    1.19 +    		<thead>
    1.20 +    			<tr>
    1.21 +    				<xsl:for-each select="tokenize($hlavička, ';')">
    1.22 +						<td><xsl:value-of select="normalize-space(.)"/></td>
    1.23 +					</xsl:for-each>
    1.24 +    			</tr>
    1.25 +    		</thead>
    1.26 +    		<tbody>
    1.27 +				<xsl:for-each select="tokenize($tělo, '\n')">
    1.28 +					<xsl:if test="normalize-space(.)">
    1.29 +						<tr>
    1.30 +							<xsl:for-each select="tokenize(., ';')">
    1.31 +								<td><xsl:value-of select="normalize-space(.)"/></td>
    1.32 +							</xsl:for-each>
    1.33 +						</tr>
    1.34 +					</xsl:if>
    1.35 +				</xsl:for-each>
    1.36 +    		</tbody>
    1.37 +    	</table>    
    1.38 +    </xsl:template>
    1.39  
    1.40  </xsl:stylesheet>