relpipe-data/makra/sparql-endpoint.xsl
author František Kučera <franta-hg@frantovo.cz>
Mon, 27 Jul 2020 17:51:53 +0200
branchv_0
changeset 310 aeda3cb4528d
permissions -rw-r--r--
examples: Querying an RDF triplestore using SPARQL

<?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 endpoint links
		*********************
		Inserts a listing of shell code to set the endpoint + link to the website.
		Warning:
			@url is not escaped and just pasted to the shell template; 
		    it could not break the XHTML output or execute something, but the shell example inside <pre/> might be invalid.
		*
		@url URL of the SPARQL endpoint e.g. https://example.com/sparql
		@website-url URL of the documentation or the organization publishing the data e.g. https://example.com/
		@website-title human readable name for @website-url
	-->
	<xsl:template match="m:sparql-endpoint">
		
		<xsl:variable name="source">
			<m:pre jazyk="shell">
				<xsl:text>export RELPIPE_IN_SPARQL_ENDPOINT="</xsl:text>
				<xsl:value-of select="@url"/>
				<xsl:text>"</xsl:text>
				<xsl:text>&#10;</xsl:text>
				<xsl:text># or relpipe-in-sparql --endpoint "</xsl:text>
				<xsl:value-of select="@url"/>
				<xsl:text>"</xsl:text>
			</m:pre>
			<p>
				Website:
				<a href="{@website-url}">					
					<xsl:value-of select="@website-title"/>
				</a>
			</p>
		</xsl:variable>
		
		<xsl:apply-templates select="$source/*"/>
		
	</xsl:template>

</xsl:stylesheet>