AW: Copy atrribute

Von: Wendell Piez <wapiez@wendellpiez.com>
Gesendet: Freitag, 21. März 2025 14:03
An: Maier, Denis Christian (UB) <denis.maier@unibe.ch>
Cc: ndw@nwalsh.com; xproc-dev@w3.org
Betreff: Re: Copy atrribute

Hello Norm and Denis,

The devil on my shoulder would like to know if you can explain why it seems like step abuse.

My guess is it has something to do with the imagined use case for the element (hence its name). But of course 'annotate-element' might be just as good a name. Isn't the real problem the way the step is named and described in the docs?

Evil-grinningly,
Wendell


You are probably right about this. Thinking a bit more about this, I’m wondering why there are two steps that perform very similar actions (p:add-attribute and p:label-elements), but with slightly different semantics (a computed attribute-value vs. a static attribute value). Can’t you express p:add-attribute in terms of p:label-elements?

Like here:
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:c="http://www.w3.org/ns/xproc-step"
    xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:fn="http://www.w3.org/2005/xpath-functions"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" version="3.0">

    <p:output port="result"/>

<p:identity>
    <p:with-input>
        <doc>
            <a/>
            <b/>
        </doc>
    </p:with-input>
</p:identity>

<p:label-elements match="a"
    attribute="result"
    label="'match'"/>

<p:add-attribute match="b" attribute-name="result" attribute-value="match"/>

</p:declare-step>

Is there something you can do with p:add-attribute, but not with p:label-elements? Otherwise, wouldn’t it make sense to just merge the steps into one?

Best,
Denis

Received on Monday, 24 March 2025 14:00:35 UTC