=====Command xaddattribute===== ====Name==== **xaddattribute** Adds attributes to matching elements ====Synopsis==== **addattribute** match-expression attribute-name attribute-value ====Options==== ||match-expression||A XSLT style match expression|| ||attribute-name||Name of attribute to add or replace|| ||attribute-value||Value of attribute|| ====Description==== addattribute is a simple front end to the [[CommandXed xed]] command which adds or replaces a single attribute to all matching nodes. The match-expression is an XSLT2.0 match expression. For all element nodes matching that expression, an attribute is added or replaced (if an attribute exists by the same name). Example: add a comment attribute to all file elements produced by xls %% xls | xaddattribute file comment "This is a file" %% Result (when run on root xmlsh directory) %%(xml) %% ====Implementation==== The xaddattribute command is implemented as a built-in xsh script %%(sh) xed -matches "$1" -a <[ attribute { $_2 } { $_3 } ]> %% ====Return Value==== Returns 0 if the command executed successfully, 1 if there was an error. ---- [[Commands]] [[CommandXed xed]] [[CommandXdelete xdelete]] [[CategoryCommands]] [[CommandsPosix]]