- From: Martin Honnen <martin.honnen@gmx.de>
- Date: Wed, 5 Feb 2025 23:39:43 +0100
- To: xproc-dev@w3.org
On 05/02/2025 23:01, David Birnbaum wrote: > Dear XProc-dev, > > I'm still learning my way around XProc, and to add unique identifier > attributes to specific elements in a document within a pipeline I used > <p:viewport> to match the elements I cared about and <p:add-attribute> > (using p:iteration-position()) to create and add the unique > identifiers. I was pleased with the result until I stumbled today over > <p:label-elements>, which I hadn't noticed / known about earlier, I > see that <p:label-elements> has a "replace" option that > <p:add-attribute> lacks, but otherwise it looks as if the two methods > can be used for the same purpose. > > Are there situations (other than where I need to control whether to > replace an existing value) where one method should be preferred over > the other? That is, what types of use-cases motivated the decision to > make both methods available in the language? Thanks for any guidance! > Perhaps one advantage that p:label-elements gives you is that positional index variable "An additional variable $p:index is available that holds the index (sequence number) of the match" exposed in the "label" expression.
Received on Wednesday, 5 February 2025 22:38:13 UTC