Re: Copy atrribute

Wendell Piez <wapiez@wendellpiez.com> writes:
> On occasion I confess I have used p:label-element to get around this -- it accepts an XPath to be evaluated, not just a string.

Indeed. I thought about that for 30 seconds and persuaded myself that it couldn’t be made to work for this example. Your observation persuaded me to think a little longer. It feels a little like “step abuse”, but this works:

  <p:identity>
    <p:with-input>
      <doc>
        <a data-custom-style="spoon"/>
        <b data-custom-style="fork"/>
      </doc>
    </p:with-input>
  </p:identity>

  <p:label-elements match="*[@data-custom-style]"
                    attribute="class"
                    label="@data-custom-style"/>

producing

<doc>
   <a data-custom-style="spoon" class="spoon"/>
   <b data-custom-style="fork" class="fork"/>
</doc>

                                        Be seeing you,
                                          norm

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

> A jester unemployed is nobody's fool.--Danny Kaye

Received on Friday, 21 March 2025 08:42:39 UTC