Skip to content

Commit dd26e6c

Browse files
namedgraphclaude
andcommitted
Resolve static asset URLs against $lapp:origin per dataspace
Static asset URLs (CSS, JS, img, translations.rdf catalog keys) were being resolved against $ac:contextUri — the request-derived URL — which in proxied multi-dataspace setups can carry the wrong host and render links pointing at the root dataspace instead of the current one. Switch every `resolve-uri('static/...', $ac:contextUri)` to use $lapp:origin (the matched application's configured origin), guard the Style template with a $lapp:origin predicate, and re-emit the Web-Client-imported CSS explicitly so the override no longer chains through xsl:apply-imports. Also collapse the ontology location-mapping catalog keys: the first argument is already an absolute URI, so resolve-uri(...) was a no-op wrapper — replaced with a plain xs:anyURI(...) cast. SKOS package layout.xsl gets the same treatment. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8b8aa5d commit dd26e6c

18 files changed

Lines changed: 179 additions & 176 deletions

File tree

src/main/resources/com/linkeddatahub/packages/skos/layout.xsl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE xsl:stylesheet [
33
<!ENTITY ldh "https://w3id.org/atomgraph/linkeddatahub#">
4+
<!ENTITY lapp "https://w3id.org/atomgraph/linkeddatahub/apps#">
45
<!ENTITY ac "https://w3id.org/atomgraph/client#">
56
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
67
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
@@ -15,6 +16,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1516
xmlns:xhtml="http://www.w3.org/1999/xhtml"
1617
xmlns:xs="http://www.w3.org/2001/XMLSchema"
1718
xmlns:ldh="&ldh;"
19+
xmlns:lapp="&lapp;"
1820
xmlns:ac="&ac;"
1921
xmlns:rdf="&rdf;"
2022
xmlns:rdfs="&rdfs;"
@@ -31,29 +33,29 @@ exclude-result-prefixes="#all">
3133

3234
<xsl:param name="foaf:Agent" as="document-node()?"/>
3335

34-
<xsl:template match="rdf:RDF | srx:sparql" mode="xhtml:Style">
36+
<xsl:template match="rdf:RDF[$lapp:origin] | srx:sparql[$lapp:origin]" mode="xhtml:Style">
3537
<xsl:param name="load-wymeditor" select="exists($foaf:Agent//@rdf:about)" as="xs:boolean"/>
3638
<xsl:param name="load-yasqe" select="true()" as="xs:boolean"/>
3739

3840
<xsl:apply-imports/>
3941

4042
<!-- inject custom Bootstrap theme that overrides the default one -->
41-
<link href="{resolve-uri('static/com/linkeddatahub/demo/skos/css/bootstrap.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
43+
<link href="{resolve-uri('static/com/linkeddatahub/demo/skos/css/bootstrap.css', $lapp:origin)}" rel="stylesheet" type="text/css"/>
4244
<!-- re-apply LinkedDataHub's Bootstrap customizations -->
43-
<link href="{resolve-uri('static/com/atomgraph/linkeddatahub/css/bootstrap.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
45+
<link href="{resolve-uri('static/com/atomgraph/linkeddatahub/css/bootstrap.css', $lapp:origin)}" rel="stylesheet" type="text/css"/>
4446

4547
<xsl:if test="$load-wymeditor">
46-
<link href="{resolve-uri('static/com/atomgraph/linkeddatahub/js/wymeditor/skins/default/skin.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
48+
<link href="{resolve-uri('static/com/atomgraph/linkeddatahub/js/wymeditor/skins/default/skin.css', $lapp:origin)}" rel="stylesheet" type="text/css"/>
4749
</xsl:if>
4850
<xsl:if test="$load-yasqe">
49-
<link href="{resolve-uri('static/css/yasqe.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
51+
<link href="{resolve-uri('static/css/yasqe.css', $lapp:origin)}" rel="stylesheet" type="text/css"/>
5052
</xsl:if>
5153
</xsl:template>
5254

53-
<xsl:template match="rdf:RDF" mode="xhtml:Style">
55+
<xsl:template match="rdf:RDF[$lapp:origin]" mode="xhtml:Style">
5456
<xsl:next-match/>
5557

56-
<link href="{resolve-uri('static/com/linkeddatahub/demo/skos/css/bootstrap.css', $ac:contextUri)}" rel="stylesheet" type="text/css"/>
58+
<link href="{resolve-uri('static/com/linkeddatahub/demo/skos/css/bootstrap.css', $lapp:origin)}" rel="stylesheet" type="text/css"/>
5759
</xsl:template>
5860

5961
<xsl:template match="skos:narrower | skos:broader | skos:related | skos:member" mode="bs2:PropertyList"/>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/acl/layout.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ WHERE
7171
<xsl:if test="$notifications/rdf:RDF/*[@rdf:about]">
7272
<li>
7373
<div class="btn-group">
74-
<button title="{ac:label(key('resources', 'notifications', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri))))}">
75-
<xsl:apply-templates select="key('resources', 'notifications', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ldh:logo">
74+
<button title="{ac:label(key('resources', 'notifications', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin))))}">
75+
<xsl:apply-templates select="key('resources', 'notifications', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ldh:logo">
7676
<xsl:with-param name="class" select="'btn btn-primary dropdown-toggle'"/>
7777
</xsl:apply-templates>
7878
</button>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/admin/signup.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ exclude-result-prefixes="#all">
139139
</xsl:if>
140140

141141
<xsl:variable name="selected" select="." as="xs:anyURI"/>
142-
<xsl:for-each select="document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/countries.rdf', $ac:contextUri))/rdf:RDF/*[@rdf:about]">
142+
<xsl:for-each select="document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/admin/countries.rdf', $lapp:origin))/rdf:RDF/*[@rdf:about]">
143143
<xsl:sort select="ac:label(.)" lang="{$ldt:lang}"/>
144144
<xsl:apply-templates select="." mode="xhtml:Option">
145145
<xsl:with-param name="selected" select="@rdf:about = $selected"/>
@@ -294,7 +294,7 @@ exclude-result-prefixes="#all">
294294

295295
<xsl:template match="*[@rdf:about = '&foaf;mbox'][ac:absolute-path(ldh:request-uri()) = resolve-uri(encode-for-uri('sign up'), ldt:base())]" mode="ac:label" priority="1">
296296
<xsl:value-of>
297-
<xsl:apply-templates select="key('resources', 'email', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
297+
<xsl:apply-templates select="key('resources', 'email', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
298298
</xsl:value-of>
299299
</xsl:template>
300300

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ exclude-result-prefixes="#all"
360360
<!-- delete existing block -->
361361
<xsl:when test="$block/@about">
362362
<!-- show a confirmation prompt -->
363-
<xsl:if test="ixsl:call(ixsl:window(), 'confirm', [ ac:label(key('resources', 'are-you-sure', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))) ])">
363+
<xsl:if test="ixsl:call(ixsl:window(), 'confirm', [ ac:label(key('resources', 'are-you-sure', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))) ])">
364364
<ixsl:set-style name="cursor" select="'progress'" object="ixsl:page()//body"/>
365365

366366
<xsl:variable name="block-uri" select="$block/@about" as="xs:anyURI"/>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/chart.xsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ exclude-result-prefixes="#all"
272272
<xsl:param name="form-actions" as="element()?">
273273
<div class="form-actions">
274274
<button class="btn btn-primary btn-save-chart" type="button">
275-
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ldh:logo">
275+
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ldh:logo">
276276
<xsl:with-param name="class" select="'btn btn-primary btn-save-chart'"/>
277277
</xsl:apply-templates>
278278

279-
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
279+
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
280280
</button>
281281
</div>
282282
</xsl:param>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/query.xsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,22 @@ exclude-result-prefixes="#all"
223223

224224
<div class="form-actions">
225225
<button type="submit">
226-
<xsl:apply-templates select="key('resources', 'run', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ldh:logo">
226+
<xsl:apply-templates select="key('resources', 'run', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ldh:logo">
227227
<xsl:with-param name="class" select="'btn btn-primary btn-run-query'"/>
228228
</xsl:apply-templates>
229229

230230
<xsl:value-of>
231-
<xsl:apply-templates select="key('resources', 'run', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
231+
<xsl:apply-templates select="key('resources', 'run', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
232232
</xsl:value-of>
233233
</button>
234234
<button type="button" class="btn btn-primary btn-open-query">
235235
<xsl:value-of>
236-
<xsl:apply-templates select="key('resources', 'open', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
236+
<xsl:apply-templates select="key('resources', 'open', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
237237
</xsl:value-of>
238238
</button>
239239
<button type="button" class="btn btn-primary btn-save btn-save-query">
240240
<xsl:value-of>
241-
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
241+
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
242242
</xsl:value-of>
243243
</button>
244244
</div>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/block/view.xsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ exclude-result-prefixes="#all"
224224
<xsl:choose>
225225
<xsl:when test="@name = $count-var-name">
226226
<strong>
227-
<xsl:apply-templates select="key('resources', 'total-results', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
227+
<xsl:apply-templates select="key('resources', 'total-results', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
228228
<xsl:text> </xsl:text>
229229
<span class="badge badge-inverse">
230230
<xsl:value-of select="srx:literal"/>
@@ -796,7 +796,7 @@ exclude-result-prefixes="#all"
796796
<option>
797797
<xsl:value-of>
798798
<xsl:text>[</xsl:text>
799-
<xsl:apply-templates select="key('resources', 'none', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
799+
<xsl:apply-templates select="key('resources', 'none', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
800800
<xsl:text>]</xsl:text>
801801
</xsl:value-of>
802802
</option>
@@ -820,14 +820,14 @@ exclude-result-prefixes="#all"
820820
<xsl:when test="not($desc)">
821821
<button type="button" class="btn btn-order-by">
822822
<xsl:value-of>
823-
<xsl:apply-templates select="key('resources', 'ascending', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
823+
<xsl:apply-templates select="key('resources', 'ascending', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
824824
</xsl:value-of>
825825
</button>
826826
</xsl:when>
827827
<xsl:otherwise>
828828
<button type="button" class="btn btn-order-by btn-order-by-desc">
829829
<xsl:value-of>
830-
<xsl:apply-templates select="key('resources', 'descending', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
830+
<xsl:apply-templates select="key('resources', 'descending', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
831831
</xsl:value-of>
832832
</button>
833833
</xsl:otherwise>
@@ -1148,7 +1148,7 @@ exclude-result-prefixes="#all"
11481148
</xsl:if>
11491149

11501150
<h2 class="nav-header btn">
1151-
<xsl:apply-templates select="key('resources', 'related-results', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
1151+
<xsl:apply-templates select="key('resources', 'related-results', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
11521152
</h2>
11531153

11541154
<ul id="{$properties-container-id}" class="well well-small nav nav-list">

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/client/constructor.xsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,20 @@ exclude-result-prefixes="#all"
144144
<p>
145145
<button type="button" class="btn btn-primary create-action add-constructor">
146146
<xsl:value-of>
147-
<xsl:apply-templates select="key('resources', 'constructor', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
147+
<xsl:apply-templates select="key('resources', 'constructor', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
148148
</xsl:value-of>
149149
</button>
150150
</p>
151151
</div>
152152
<div class="form-actions modal-footer">
153153
<button type="button" class="btn btn-primary btn-save">
154154
<xsl:value-of>
155-
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
155+
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
156156
</xsl:value-of>
157157
</button>
158158
<button type="button" class="btn btn-close">
159159
<xsl:value-of>
160-
<xsl:apply-templates select="key('resources', 'cancel', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
160+
<xsl:apply-templates select="key('resources', 'cancel', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
161161
</xsl:value-of>
162162
</button>
163163
</div>
@@ -225,7 +225,7 @@ exclude-result-prefixes="#all"
225225
<button type="button" class="btn btn-small pull-right btn-remove-property" tabindex="-1">
226226
<xsl:attribute name="title">
227227
<xsl:value-of>
228-
<xsl:apply-templates select="key('resources', 'remove-stmt', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
228+
<xsl:apply-templates select="key('resources', 'remove-stmt', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
229229
</xsl:value-of>
230230
</xsl:attribute>
231231
</button>
@@ -238,7 +238,7 @@ exclude-result-prefixes="#all"
238238
</xsl:if>
239239
</input>
240240
<xsl:value-of>
241-
<xsl:apply-templates select="key('resources', 'resource', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
241+
<xsl:apply-templates select="key('resources', 'resource', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
242242
</xsl:value-of>
243243
</label>
244244
<label class="radio">
@@ -248,7 +248,7 @@ exclude-result-prefixes="#all"
248248
</xsl:if>
249249
</input>
250250
<xsl:value-of>
251-
<xsl:apply-templates select="key('resources', 'literal', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ac:label"/>
251+
<xsl:apply-templates select="key('resources', 'literal', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $lapp:origin)))" mode="ac:label"/>
252252
</xsl:value-of>
253253
</label>
254254

0 commit comments

Comments
 (0)