relpipe-data/makra/sparql-example.xsl
branchv_0
changeset 310 aeda3cb4528d
equal deleted inserted replaced
309:71a627e72815 310:aeda3cb4528d
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <xsl:stylesheet version="2.0"
       
     3 				xmlns="http://www.w3.org/1999/xhtml"
       
     4 				xmlns:h="http://www.w3.org/1999/xhtml"
       
     5 				xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
       
     6 				xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace"
       
     7 				xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro"
       
     8 				xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
     9 				xmlns:fn="http://www.w3.org/2005/xpath-functions"
       
    10 				xmlns:svg="http://www.w3.org/2000/svg"
       
    11 				xmlns:xs="http://www.w3.org/2001/XMLSchema"
       
    12 				exclude-result-prefixes="fn h s k m xs">
       
    13 	
       
    14 	<!--
       
    15 		SPARQL example listing
       
    16 		**********************
       
    17 		Inserts the listing of a SPARQL query and the listing of result.
       
    18 		Both files should already exist – the query is not executed by this macro.
       
    19 		*
       
    20 		@name base name of the file; .sparql and .txt will be appended
       
    21 		@result-description optional text (will replace default „Results:“);
       
    22 		there could be also element m:result-description containing formatted text (including the <p>…</p>)
       
    23 	-->
       
    24 	<xsl:template match="m:sparql-example">
       
    25 		
       
    26 		<xsl:variable name="source">
       
    27 			<m:pre jazyk="sparql" src="{@name}.sparql" odkaz="ano"/>
       
    28 			<xsl:choose>
       
    29 				<xsl:when test="@result-description">
       
    30 					<p>
       
    31 						<xsl:value-of select="@result-description"/>
       
    32 					</p>
       
    33 				</xsl:when>
       
    34 				<xsl:when test="m:result-description">
       
    35 					<xsl:apply-templates select="m:result-description/*"/>
       
    36 				</xsl:when>
       
    37 				<xsl:otherwise>
       
    38 					<p>Result:</p>
       
    39 				</xsl:otherwise>
       
    40 			</xsl:choose>
       
    41 			<m:pre jazyk="text" src="{@name}.txt"/>
       
    42 		</xsl:variable>
       
    43 		
       
    44 		<xsl:apply-templates select="$source/*"/>
       
    45 		
       
    46 	</xsl:template>
       
    47 
       
    48 </xsl:stylesheet>
       
    49