Re: [xsl] Add id to next element

Subject: Re: [xsl] Add id to next element
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 20 May 2022 01:34:35 -0000
Hi Graydon,

> What's wrong with
>
> <xsl:template match="section">
>     <xsl:copy>
>     	<xsl:apply-templates select="@*" mode="#current" />
>	<xsl:attribute name="id"
>	  select="(preceding-sibling::*[1][self::target]/@refid,generate-id(.)) =>
head()" />
>	<xsl:apply-templates mode="#current" />
>     </xsl:copy>
> </xsl:template>

I normally use (expr1, expr2)[1] as an if-then-else for expressions evaluating
to 0 or 1 node, but that arrow syntax is pretty neat. I should start using
it.

 - Chris

Current Thread