Skip to content

feat: xsl:param and xsl:with-param on named templates#2

Closed
no-pictures[bot] wants to merge 1 commit into
named-templatesfrom
params
Closed

feat: xsl:param and xsl:with-param on named templates#2
no-pictures[bot] wants to merge 1 commit into
named-templatesfrom
params

Conversation

@no-pictures

@no-pictures no-pictures Bot commented Jul 19, 2026

Copy link
Copy Markdown

Builds on #1 (base named-templates).

A named template's function now takes its declared parameters after the three context parameters, and xsl:call-template supplies each argument.

How it works

  • A pre-pass records each named template's parameter list by name, so a call resolves its arguments regardless of declaration order.
  • named_template_function binds the declared xsl:param names as function parameters after the context parameters.
  • xsl:call-template builds the arguments in the template's parameter order, taking the matching xsl:with-param or falling back to the parameter's own default when the call omits it.

The argument plumbing from #1 already carries any argument count, so this stays a compiler-only change with no xee-ir or interpreter edits.

Tests

test_call_template_with_param supplies a parameter, test_call_template_param_default omits one and falls back to its default, and the suite stays green.

Not covered

A parameter default that references another parameter of the same template reports an unbound variable, because the default is lowered in the caller's scope where the sibling parameter is not bound.
Constant and context-dependent defaults work, since the caller's context is preserved.

A named template's declared parameters follow its context parameters.
xsl:call-template supplies each by name via xsl:with-param, or uses the parameter's own default when the call omits it.
@gronke gronke added the blocked label Jul 19, 2026
@no-pictures

no-pictures Bot commented Jul 19, 2026

Copy link
Copy Markdown
Author

Closing in favor of Paligo#145, which implements xsl:param and xsl:with-param. The params branch stays for reference.

@no-pictures no-pictures Bot closed this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant