in reply to how to change node value based on other node value

Using XML::XSH2, a less verbose wrapper around XML::LibXML:
open file.xml ; set /Settings/Channels/Channel[@Name='L1']/@Voltage 300 ; save :b ;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: how to change node value based on other node value
by ccherri (Acolyte) on Apr 08, 2015 at 18:10 UTC

    Choroba, thanks. Your syntax gave me a clue that leads to a solution (XSH2 is not in the ppm library for Activestate and since it took almost all day to load LibXML I am reluctant to go down that path). Here is my solution, albeit a little more verbose...the syntax is at least obvious which is a benefit for simpletons like myself!

    my ($value) = $root->findnodes('/Settings[1]/Channels[1]/Channel[@Name +="Ln"]/@Voltage '); $value->setValue($new_voltage);}

    So now my question is, does the above get me into any trouble??? Thanks Again Chris