--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/relpipe-data/makra/sparql-example.xsl Mon Jul 27 17:51:53 2020 +0200
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://www.w3.org/1999/xhtml"
+ xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
+ xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
+ xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ exclude-result-prefixes="fn h s k m xs">
+
+ <!--
+ SPARQL example listing
+ **********************
+ Inserts the listing of a SPARQL query and the listing of result.
+ Both files should already exist – the query is not executed by this macro.
+ *
+ @name base name of the file; .sparql and .txt will be appended
+ @result-description optional text (will replace default „Results:“);
+ there could be also element m:result-description containing formatted text (including the <p>…</p>)
+ -->
+ <xsl:template match="m:sparql-example">
+
+ <xsl:variable name="source">
+ <m:pre jazyk="sparql" src="{@name}.sparql" odkaz="ano"/>
+ <xsl:choose>
+ <xsl:when test="@result-description">
+ <p>
+ <xsl:value-of select="@result-description"/>
+ </p>
+ </xsl:when>
+ <xsl:when test="m:result-description">
+ <xsl:apply-templates select="m:result-description/*"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <p>Result:</p>
+ </xsl:otherwise>
+ </xsl:choose>
+ <m:pre jazyk="text" src="{@name}.txt"/>
+ </xsl:variable>
+
+ <xsl:apply-templates select="$source/*"/>
+
+ </xsl:template>
+
+</xsl:stylesheet>
+