Re: p:set-attributes

On 4/26/07, Norman Walsh <ndw@nwalsh.com> wrote:
>
> | 1.11 Set-attributes
> |
> | The set-attributes step sets attribute values on the document element
> | using the attribute values provided on the document element of the
> | 'attribute' port's document. That is, it copies the attributes on the
> | document element from the 'attributes' input port to the document
> | element of the 'source' input port.
> |
> | <p:declare-step type="p:set-attributes">
> |      <p:input port="source"/>
> |      <p:input port="attributes"/>
> |      <p:output port="result"/>
> | </p:declare-step>
>
> Do we really need this?



Yes, this kind of construct is essential to building streaming pipelines.


If we do, should we make it p:copy-attributes and have it not delete the
> originals (if you want to delete the originals, you can do it with a
> preceding step).


Sometimes you don't know what attributes are on the target element.  As
such, you just want them replaced with the ones you are specifying.

And should we add a "target" option so that the attributes can be set
> on any element not only the root element?


Probably.

If it is a match pattern, then some uses won't stream.  I'm OK with that.

If it is just an element name, then all cases would stream.


-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Sunday, 29 April 2007 20:31:31 UTC