Re: [xsl] XSLT 4: xsl:template/@select

Subject: Re: [xsl] XSLT 4: xsl:template/@select
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 May 2020 17:04:06 -0000
I didn't want to create messy scoping rules for variables, e.g.

<xsl:template match="type(xs:integer)" mode="increment" select=".+1"/>

is fine, but

<xsl:template match="type(xs:integer)" mode="increment" select=".+$delta">
  <xsl:param name="delta" as="xs:integer"/>
</xsl:template>

feels a bit weird. We had similar issues with xsl:iterate - the reason
xsl:on-completion comes first is to avoid creating custom rules for variable
scoping.

Using params in match patterns gets even more interesting - useful, but
hairy:

<xsl:template match="para[@class=$class]">
  <xsl:param name="class"/>
  ...
</xsl:template>

Michael Kay
Saxonica


> On 18 May 2020, at 17:52, Graydon graydon@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
https://archive.xmlprague.cz/2020/files/xmlprague-2020-proceedings.pdf#page=1
21
>
> says in 5.1:
>
>> A template rule with a select attribute must not contain any xsl:param
>> or xsl:context-item declarations.
>
> I can easily imagine wanting xsl:param, particularly a tunnel parameter.
> For example, if the template functions to construct a target URI it
> would be helpful to be able to pass in the base URI as a parameter.
>
>
> --
> Graydon Saunders  | graydonish@xxxxxxxxx
> CC&s oferC)ode, C0isses swC! mC&g.
> -- Deor  ("That passed, so may this.")

Current Thread