feat: support named templates and xsl:call-template - #1
Closed
no-pictures[bot] wants to merge 1 commit into
Closed
Conversation
A named template compiles to a function registered under its name. xsl:call-template invokes it, running the template with the caller's context (item, position, size) as XSLT requires. Parameters — xsl:param on the template and xsl:with-param on the call — report as unsupported.
no-pictures
Bot
force-pushed
the
named-templates
branch
from
July 19, 2026 16:10
1a840bd to
08889c1
Compare
gronke
approved these changes
Jul 19, 2026
Author
|
Closing in favor of Paligo#145, which implements named templates and xsl:call-template. The named-templates branch stays for reference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Named templates compile to functions registered by name, so
xsl:call-templatecan invoke one.How it works
ir::Declarationscarries the named templates; the declaration compiler compiles each to anInlineFunctionIdand registers it in atemplate_idsmap (besidemode_ids), ahead of the rules and main so a call resolves regardless of the caller's position.xsl:call-templatepreserves the caller's context, so the call forwards the current context names as the arguments.No new instruction is needed: it reuses
Closure+Call.Tests
test_call_named_template(a plain call) andtest_call_template_keeps_caller_context(the callee reads the caller's node throughlocal-name()); the existing suite stays green.Not covered yet
Parameters —
xsl:paramon the template andxsl:with-paramon the call — report as unsupported; a follow-up adds them.