in reply to Using XML::XPath to change values
Do you want to increase all priorities or just some? If all then something like this would be enough:
use strict; use XML::Rules; my $filter = XML::Rules->new( style => "filter", rules => { priority => sub { 'priority' => $_[1]{_content}+1 }, }); $filter->filter(\*DATA, \*STDOUT);
If you need to change only some priorities, you can add some tests:
my $filter = XML::Rules->new( style => "filter", ident => ' ', rules => { _default => 'as is', include => sub { if ($_[1]{location}{_content} =~ m{/itrstemplates/}) { $_[1]{priority}{_content}++; } delete $_[1]{_content}; # remove extra whitespace return include => $_[1] }, } );
Jenda
Enoch was right!
Enjoy the last years of Rome.
|
|---|