xmlsquishsource. compose. build.
中文

XML DSL & project guide

Define contracts, then expand them

Macros have namespace-qualified names and explicit parameters. Expansion resolves a fixed target and creates an isolated invocation frame.

Jump to a chapter
On this page

Explicit call contracts

At a call, args and fills are evaluated in the caller first. The macro body then runs at its definition location with only its explicit inputs.

<xs:entry xmlns:xs="https://xmlsquish.moesegfault.dev/ns"
          xmlns:app="urn:example:app">
  <xs:import src="./macros.xml"/>
  <xs:expand ref="app:greeting">
    <xs:arg name="name" value="Klee"/>
  </xs:expand>
</xs:entry>

String parameters

Evaluates in the caller before the callee frame exists.

  • value="literal"
  • get="arg.other"
  • an evaluated body that produces text only

Structured content

Use xs:insert to emit a scalar as escaped text. It never reparses <, >, or & as markup. Use xs:fill/xs:slot when structure must remain XML.

<xs:macro name="app:panel">
  <Panel><xs:slot name="body" required="true"/></Panel>
</xs:macro>

<xs:expand ref="app:panel">
  <xs:fill name="body"><Message>Hello</Message></xs:fill>
</xs:expand>