author | František Kučera <franta-hg@frantovo.cz> |
Tue, 04 Aug 2020 00:59:32 +0200 | |
branch | v_0 |
changeset 313 | a43265235e5a |
parent 310 | aeda3cb4528d |
permissions | -rw-r--r-- |
310
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
<xsl:stylesheet version="2.0" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
xmlns="http://www.w3.org/1999/xhtml" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
xmlns:h="http://www.w3.org/1999/xhtml" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
xmlns:svg="http://www.w3.org/2000/svg" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
exclude-result-prefixes="fn h s k m xs"> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
|
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
<!-- |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
SPARQL example listing |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
********************** |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
Inserts the listing of a SPARQL query and the listing of result. |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
Both files should already exist – the query is not executed by this macro. |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
* |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
@name base name of the file; .sparql and .txt will be appended |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
@result-description optional text (will replace default „Results:“); |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
there could be also element m:result-description containing formatted text (including the <p>…</p>) |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
--> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
<xsl:template match="m:sparql-example"> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
|
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
<xsl:variable name="source"> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
<m:pre jazyk="sparql" src="{@name}.sparql" odkaz="ano"/> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
<xsl:choose> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
<xsl:when test="@result-description"> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
<p> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
<xsl:value-of select="@result-description"/> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
</p> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
</xsl:when> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
<xsl:when test="m:result-description"> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
<xsl:apply-templates select="m:result-description/*"/> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
36 |
</xsl:when> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
37 |
<xsl:otherwise> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
38 |
<p>Result:</p> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
39 |
</xsl:otherwise> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
40 |
</xsl:choose> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
41 |
<m:pre jazyk="text" src="{@name}.txt"/> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
42 |
</xsl:variable> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
43 |
|
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
44 |
<xsl:apply-templates select="$source/*"/> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
45 |
|
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
46 |
</xsl:template> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
47 |
|
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
48 |
</xsl:stylesheet> |
aeda3cb4528d
examples: Querying an RDF triplestore using SPARQL
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
49 |