You are trying to alter an attribute:
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
use Mojo::DOM;
my $xml = '<header>
<idset id="100">
<a>item_a</a>
<b>item_b</b>
</idset>
</header>';
my $dom = Mojo::DOM->new->xml(1)->parse( $xml );
# say current attribute value
say 'Current value: ' . $dom->at('idset:first-of-type')->attr('id');
# change it to something
$dom->at('idset:first-of-type')->attr(id => 'derp');
# dump the whole DOM
say $dom->content;
Output:
Current value: 100
<header>
<idset id="derp">
<a>item_a</a>
<b>item_b</b>
</idset>
</header>