Re: Copy atrribute

<denis.maier@unibe.ch> writes:
> I need to copy the value of an attribute to another attribute. Should be easy, but no success so far. This here won’t work:
>
> <p:add-attribute match="*[@data-custom-style]" attribute-name="class">
>             <p:with-option name="attribute-value"
> select="'@data-custom-style'"></p:with-option>
>         </p:add-attribute>

No, that’s not really how the add-attribute step works. No matter what you do to initialize the attribute-value option, it’s going to get that value at the beginning of the step; it’s not going to get recalculated for each match.

It’s interesting that this has never come up before. I wonder how many other steps with “match” attributes have use cases where this would be useful behavior.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh <ndw@nwalsh.com>
https://norm.tovey-walsh.com/

> The art of being wise is the art of knowing what to overlook.--William
> James

Received on Thursday, 20 March 2025 16:09:40 UTC