šablona/makra/vycpávka.xsl
author František Kučera <franta-hg@frantovo.cz>
Tue, 29 Oct 2019 16:40:23 +0100
branchv_0
changeset 279 de1b49ba06f1
parent 98 532deb4b908e
permissions -rw-r--r--
examples: SELECTing from SQLite databases

<?xml version="1.0" encoding="UTF-8"?>
<!--
XML Web generátor – program na generování webových stránek
Copyright © 2012 František Kučera (frantovo.cz)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<xsl:stylesheet version="2.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	exclude-result-prefixes="m">
	
	<!--
		Vycpávkový text
		***************
		Vkládá Lorem Ipsum.
		*
		@odstavců počet odstavců k vložení
	-->
	<xsl:template match="m:vycpávka">
		<!-- 
			TODO: stáhnout jen jednou, uložit do souboru a při dalších generováních brát z něj.
			http://www.w3.org/TR/xslt20/#result-trees
		-->
		<xsl:message>Stahuji vycpávkový text z http://lipsum.lipsum.com/</xsl:message>
		<xsl:variable name="prostýText" select="document(concat('http://lipsum.lipsum.com/feed/xml?amount=', @odstavců, '&amp;what=paragraphs'))/feed/lipsum"/>
		<xsl:for-each select="tokenize($prostýText, '\n')">
			<p><xsl:value-of select="."/></p>
		</xsl:for-each>
	</xsl:template>

</xsl:stylesheet>