Skip to content

Move ldh:view block injection client-side under Saxon-JS#295

Merged
namedgraph merged 2 commits into
developfrom
fix-view-injection
May 10, 2026
Merged

Move ldh:view block injection client-side under Saxon-JS#295
namedgraph merged 2 commits into
developfrom
fix-view-injection

Conversation

@namedgraph
Copy link
Copy Markdown
Member

The SSR-only wrapper template (resource.xsl:605) injected view blocks synchronously via document() against the ?ns SPARQL endpoint, which worked under SAXON but was compiled out of the Saxon-JS SEF. Initial load painted the wrappers correctly, but client.xsl:537 replaced the SSR document-body with a fresh Saxon-JS render that lacked them, and view.xsl:62 had nothing to hydrate.

  • resource.xsl: drop the SAXON-only wrapper template; add a Saxon-JS-only bs2:Row template at priority 0.7 that always wraps non-typed-block resources in outer div + inner div.span12 around next-match output, so client-side injection has a host whose @about ends in #this for primary topics. Excludes types handled by resource.xsl:463 to avoid injecting spurious nesting into View/Object/Query/Chart chains.

  • layout.xsl: drop unused $forward-view-query and $inverse-view-query.

  • client/block.xsl: add combined $view-query (forward + inverse via UNION); amend default mode='ldh:RenderRow' template to fan out per wrapper (xsl:for-each over the inner typed-block selector); add ldh:view-blocks-{self,query,fetch,render}-thunk mirroring the view.xsl:107-147 pattern. Render step calls apply-templates mode='bs2:Row' on the loaded View resource - same call the deleted SSR code used - so the injected HTML matches resource.xsl:463 output byte-for-byte.

namedgraph and others added 2 commits May 10, 2026 20:52
The SSR-only wrapper template (resource.xsl:605) injected view blocks
synchronously via document() against the ?ns SPARQL endpoint, which
worked under SAXON but was compiled out of the Saxon-JS SEF. Initial
load painted the wrappers correctly, but client.xsl:537 replaced the
SSR document-body with a fresh Saxon-JS render that lacked them, and
view.xsl:62 had nothing to hydrate.

- resource.xsl: drop the SAXON-only wrapper template; add a Saxon-JS-only
  bs2:Row template at priority 0.7 that always wraps non-typed-block
  resources in outer div + inner div.span12 around next-match output,
  so client-side injection has a host whose @about ends in #this for
  primary topics. Excludes types handled by resource.xsl:463 to avoid
  injecting spurious nesting into View/Object/Query/Chart chains.

- layout.xsl: drop unused $forward-view-query and $inverse-view-query.

- client/block.xsl: add combined $view-query (forward + inverse via
  UNION); amend default mode='ldh:RenderRow' template to fan out per
  wrapper (xsl:for-each over the inner typed-block selector); add
  ldh:view-blocks-{self,query,fetch,render}-thunk mirroring the
  view.xsl:107-147 pattern. Render step calls apply-templates
  mode='bs2:Row' on the loaded View resource - same call the deleted
  SSR code used - so the injected HTML matches resource.xsl:463 output
  byte-for-byte.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@namedgraph namedgraph merged commit 747b6ec into develop May 10, 2026
1 check passed
@namedgraph namedgraph deleted the fix-view-injection branch May 10, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant