Skip to content

Commit 0d4cea0

Browse files
namedgraphclaude
andcommitted
Gate client-side vocab-doc lookups on ixsl:doc-fetched()
The doc-available()/document(namespace-uri()) branch in ac:property-label (default.xsl) was unguarded after #298, so on Saxon-JS it fell back to a synchronous XMLHttpRequest for every property whose namespace wasn't already in the documentPool. With ?mode= on the source RDF's base URI, document('') resolved to the page URL and Firefox served the cached HTML representation to that sync XHR, producing the cascade of "XML Parsing Error: Expected: </meta>" failures after ldh:set-property-metadata. ac:property-label is invoked from xsl:sort and can't be made async, so the fix uses Saxon-JS's own ixsl:doc-fetched() — a synchronous probe of the internal documentPool (SaxonJS3.rt.js: I.fixed.Ta[$uri]) that triggers no fetch. Saxon's doc-available() probe is restored with its pre-#298 use-when="...SAXON" guard so server-side behaviour is unchanged. ac:object-label gets the symmetric addition: the LDH override at default.xsl:87 had inherited the SPARQL-based $object-metadata branch but dropped Web-Client's doc-fetch branch entirely, so object URIs whose label lived in a cached vocab (e.g. skos:Concept, ldh:View) never resolved client-side. Both processors now have parallel chains: local source RDF → async-loaded metadata → documentPool/live-fetch → URI heuristics. rdf.xsl bs2:TypeControl gets the same gating: ac:label(key(..., ...)) stays unconditional, only the document() source inside key() is wrapped in if (ixsl:doc-fetched(...)) then ... else () on Saxon-JS to avoid the sync XHR. xmlns:ixsl declaration added to rdf.xsl since it didn't have one. Debug xsl:message lines included in all three SaxonJS branches to verify which lookups take the documentPool path; safe to strip in a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6fcca1a commit 0d4cea0

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

  • src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports/default.xsl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ exclude-result-prefixes="#all"
9696
<!-- <xsl:message>ac:object-label(<xsl:value-of select="."/>) $object-metadata: <xsl:value-of select="serialize($object-metadata)"/></xsl:message> -->
9797
<xsl:apply-templates select="$object-metadata!key('resources', $this, .)" mode="ac:label"/>
9898
</xsl:when>
99+
<xsl:when test="ixsl:doc-fetched(ac:document-uri(.)) and key('resources', ., document(ac:document-uri(.)))" use-when="system-property('xsl:product-name') eq 'SaxonJS'">
100+
<xsl:message select="'ac:object-label doc-fetched HIT: ' || ac:document-uri(.) || ' for ' || ."/>
101+
<xsl:apply-templates select="key('resources', ., document(ac:document-uri(.)))" mode="ac:label"/>
102+
</xsl:when>
103+
<xsl:when test="doc-available(ac:document-uri(.)) and key('resources', ., document(ac:document-uri(.)))" use-when="system-property('xsl:product-name') = 'SAXON'">
104+
<xsl:apply-templates select="key('resources', ., document(ac:document-uri(.)))" mode="ac:label"/>
105+
</xsl:when>
99106
<xsl:when test="contains(., '#') and not(ends-with(., '#'))">
100107
<xsl:sequence select="substring-after(., '#')"/>
101108
</xsl:when>
@@ -418,7 +425,11 @@ exclude-result-prefixes="#all"
418425
<xsl:when test="$property-metadata/key('resources', $this, .)">
419426
<xsl:apply-templates select="$property-metadata/key('resources', $this, .)" mode="ac:label"/>
420427
</xsl:when>
421-
<xsl:when test="doc-available(ac:document-uri(namespace-uri())) and key('resources', $this, document(ac:document-uri(namespace-uri())))">
428+
<xsl:when test="ixsl:doc-fetched(ac:document-uri(namespace-uri())) and key('resources', $this, document(ac:document-uri(namespace-uri())))" use-when="system-property('xsl:product-name') eq 'SaxonJS'">
429+
<xsl:message select="'ac:property-label doc-fetched HIT: ' || ac:document-uri(namespace-uri()) || ' for ' || $this"/>
430+
<xsl:apply-templates select="key('resources', $this, document(ac:document-uri(namespace-uri())))" mode="ac:label"/>
431+
</xsl:when>
432+
<xsl:when test="doc-available(ac:document-uri(namespace-uri())) and key('resources', $this, document(ac:document-uri(namespace-uri())))" use-when="system-property('xsl:product-name') = 'SAXON'">
422433
<xsl:apply-templates select="key('resources', $this, document(ac:document-uri(namespace-uri())))" mode="ac:label"/>
423434
</xsl:when>
424435
<xsl:otherwise>

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/imports/rdf.xsl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<xsl:stylesheet version="3.0"
2323
xmlns="http://www.w3.org/1999/xhtml"
2424
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
25+
xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
2526
xmlns:xhtml="http://www.w3.org/1999/xhtml"
2627
xmlns:xs="http://www.w3.org/2001/XMLSchema"
2728
xmlns:lapp="&lapp;"
@@ -72,7 +73,11 @@ exclude-result-prefixes="#all">
7273
</xsl:call-template>
7374

7475
<label class="control-label" for="{$for}" title="{$this}">
75-
<xsl:value-of select="ac:label(key('resources', $this, document(ac:document-uri(namespace-uri()))))"/>
76+
<xsl:value-of select="ac:label(key('resources', $this, document(ac:document-uri(namespace-uri()))))" use-when="system-property('xsl:product-name') = 'SAXON'"/>
77+
<xsl:if test="ixsl:doc-fetched(ac:document-uri(namespace-uri()))" use-when="system-property('xsl:product-name') eq 'SaxonJS'">
78+
<xsl:message select="'rdf.xsl bs2:TypeControl doc-fetched HIT: ' || ac:document-uri(namespace-uri()) || ' for ' || $this"/>
79+
</xsl:if>
80+
<xsl:value-of select="ac:label(key('resources', $this, if (ixsl:doc-fetched(ac:document-uri(namespace-uri()))) then document(ac:document-uri(namespace-uri())) else ()))" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
7681
</label>
7782

7883
<div class="controls">

0 commit comments

Comments
 (0)