tame: preproc/template.xsl: param-copy: Utilize TAMER application convention

TAMER desugars shorthand template application bodies (`@values@`) into _the
name of a closed template_ whose body should be expanded into place.  This
change recognizes that convention, and makes use of it.

Desugaring is part of `nir::tplshort`.

DEV-13708
main
Mike Gerwitz 2023-04-12 14:52:06 -04:00
parent b7aae207c2
commit 2325eb1b2f
1 changed files with 22 additions and 3 deletions

View File

@ -657,10 +657,29 @@
select="lv:param-meta" />
<variable name="varname" select="@name" />
<variable name="param" select="$params[ @name=$varname ]" />
<!-- determine the nodes to copy -->
<variable name="copy"
select="$params[ @name=$varname ]/*" />
<variable name="copy" as="node()*">
<choose>
<!-- TAMER desugared @values@ application convention (see tplshort.rs) -->
<when test="$param/@value">
<!-- the value is the name of a template to copy the body from -->
<variable name="dsgr" select="$param/@value" />
<!-- the template is always positioned as the immeditely-following
sibling of the `lv:apply-template` node -->
<sequence select="$params/parent::lv:apply-template
/following-sibling::lv:template[ @name=$dsgr ]
/*" />
</when>
<!-- old applicatication convention has child nodes within
`with-param` -->
<otherwise>
<sequence select="$param/*" />
</otherwise>
</choose>
</variable>
<choose>
<!-- if the @expand flag is set, then immediately begin expanding any