Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bdc0ac7

Browse filesBrowse files
committed
Refactored top-level XSLT templates to handle both rdf:RDF and srx:sparql documents
Fixed bugs in the xhtml:Table mode for srx:sparql
1 parent 6ed4503 commit bdc0ac7
Copy full SHA for bdc0ac7

File tree

Expand file treeCollapse file tree

2 files changed

+36
-18
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+36
-18
lines changed

‎src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/layout.xsl

Copy file name to clipboardExpand all lines: src/main/webapp/static/com/atomgraph/client/xsl/bootstrap/2.3.2/layout.xsl
+34-14Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ limitations under the License.
2222
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
2323
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
2424
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
25+
<!ENTITY srx "http://www.w3.org/2005/sparql-results#">
2526
<!ENTITY http "http://www.w3.org/2011/http#">
2627
<!ENTITY ldt "https://www.w3.org/ns/ldt#">
2728
<!ENTITY sd "http://www.w3.org/ns/sparql-service-description#">
@@ -39,6 +40,7 @@ xmlns:ac="&ac;"
3940
xmlns:rdf="&rdf;"
4041
xmlns:rdfs="&rdfs;"
4142
xmlns:owl="&owl;"
43+
xmlns:srx="&srx;"
4244
xmlns:http="&http;"
4345
xmlns:ldt="&ldt;"
4446
xmlns:dct="&dct;"
@@ -103,22 +105,34 @@ exclude-result-prefixes="#all">
103105

104106
<xsl:template match="/">
105107
<html lang="{$ldt:lang}">
106-
<xsl:variable name="grouped-rdf" as="document-node()">
107-
<xsl:apply-templates select="." mode="ac:GroupTriples"/>
108-
</xsl:variable>
109-
110-
<xsl:apply-templates select="$grouped-rdf/rdf:RDF" mode="xhtml:Head"/>
111-
112-
<xsl:apply-templates select="$grouped-rdf/rdf:RDF" mode="xhtml:Body"/>
108+
<xsl:apply-templates/>
113109
</html>
114110
</xsl:template>
115111

116-
<xsl:template match="rdf:RDF" mode="xhtml:Head">
112+
<xsl:template match="rdf:RDF">
113+
<xsl:variable name="grouped-rdf" as="document-node()">
114+
<xsl:apply-templates select="root(.)" mode="ac:GroupTriples"/>
115+
</xsl:variable>
116+
117+
<xsl:for-each select="$grouped-rdf/rdf:RDF">
118+
<xsl:apply-templates select="." mode="xhtml:Head"/>
119+
120+
<xsl:apply-templates select="." mode="xhtml:Body"/>
121+
</xsl:for-each>
122+
</xsl:template>
123+
124+
<xsl:template match="srx:sparql">
125+
<xsl:apply-templates select="." mode="xhtml:Head"/>
126+
127+
<xsl:apply-templates select="." mode="xhtml:Body"/>
128+
</xsl:template>
129+
130+
<xsl:template match="rdf:RDF | srx:sparql" mode="xhtml:Head">
117131
<head>
118132
<xsl:apply-templates select="." mode="xhtml:Meta"/>
119-
133+
120134
<xsl:apply-templates select="." mode="xhtml:Title"/>
121-
135+
122136
<xsl:apply-templates select="." mode="xhtml:Style"/>
123137

124138
<xsl:apply-templates select="." mode="xhtml:Script"/>
@@ -141,6 +155,12 @@ exclude-result-prefixes="#all">
141155
</body>
142156
</xsl:template>
143157

158+
<xsl:template match="srx:sparql" mode="xhtml:Body">
159+
<body>
160+
<xsl:apply-templates select="." mode="xhtml:Table"/>
161+
</body>
162+
</xsl:template>
163+
144164
<xsl:template match="rdf:RDF" mode="bs2:NavBar">
145165
<div class="navbar navbar-fixed-top">
146166
<div class="navbar-inner">
@@ -267,7 +287,7 @@ exclude-result-prefixes="#all">
267287

268288
<!-- META -->
269289

270-
<xsl:template match="rdf:RDF" mode="xhtml:Meta">
290+
<xsl:template match="rdf:RDF | srx:sparql" mode="xhtml:Meta">
271291
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
272292
</xsl:template>
273293

@@ -279,7 +299,7 @@ exclude-result-prefixes="#all">
279299
</title>
280300
</xsl:template>
281301

282-
<xsl:template match="rdf:RDF[ac:uri()]" mode="xhtml:Title" priority="1">
302+
<xsl:template match="rdf:RDF[ac:uri()] | srx:sparql" mode="xhtml:Title" priority="1">
283303
<title>
284304
<xsl:value-of>
285305
<xsl:apply-templates select="key('resources', ac:document-uri(ac:uri()))" mode="ac:label"/>
@@ -291,15 +311,15 @@ exclude-result-prefixes="#all">
291311

292312
<!-- STYLE -->
293313

294-
<xsl:template match="rdf:RDF" mode="xhtml:Style">
314+
<xsl:template match="rdf:RDF | srx:sparql" mode="xhtml:Style">
295315
<link href="{resolve-uri('static/css/bootstrap.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
296316
<link href="{resolve-uri('static/css/bootstrap-responsive.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
297317
<link href="{resolve-uri('static/com/atomgraph/client/css/bootstrap.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
298318
</xsl:template>
299319

300320
<!-- SCRIPT -->
301321

302-
<xsl:template match="rdf:RDF" mode="xhtml:Script">
322+
<xsl:template match="rdf:RDF | srx:sparql" mode="xhtml:Script">
303323
<script type="text/javascript" src="{resolve-uri('static/js/jquery.min.js', $ac:contextUri)}" defer="defer"></script>
304324
<script type="text/javascript" src="{resolve-uri('static/js/bootstrap.js', $ac:contextUri)}" defer="defer"></script>
305325
<script type="text/javascript" src="{resolve-uri('static/com/atomgraph/client/js/UUID.js', $ac:contextUri)}" defer="defer"></script>

‎src/main/webapp/static/com/atomgraph/client/xsl/imports/default.xsl

Copy file name to clipboardExpand all lines: src/main/webapp/static/com/atomgraph/client/xsl/imports/default.xsl
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ exclude-result-prefixes="#all">
471471

472472
<xsl:template match="srx:variable" mode="xhtml:Table">
473473
<th>
474-
<xsl:sequence select="@name"/>
474+
<xsl:value-of select="@name"/>
475475
</th>
476476
</xsl:template>
477477

@@ -494,9 +494,7 @@ exclude-result-prefixes="#all">
494494
</xsl:template>
495495

496496
<xsl:template match="srx:uri" mode="xhtml:Table">
497-
<a href="{.}" title="{.}">
498-
<xsl:sequence select="."/>
499-
</a>
497+
<xsl:apply-templates select="."/>
500498
</xsl:template>
501499

502500
<!-- INPUT MODE -->

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.