#!/usr/bin/perl use warnings; use strict; use XML::XSH2; package XML::XSH2::Map; our ($path, $value, $v); package main; xsh << 'end.'; open 1.xml ; register-namespace am http://www.abc.com/xml/appmanagement ; end. my ($replace, $add); open my $PROP, '<', 'properties' or die $!; while (<$PROP>) { chomp; s=^M_([RA])_/?== or next; my $action = $1; ($path, $value) = split / = /; xsh << ' end.'; $v = //am:name[.=$path]/../am:value ; if $v set $v/text() $value ; end. next if $v; $path =~ s=/=/am:=g; xsh "set /am:$path '$value'"; } xsh 'save :f new.xml';