I do not understand exactly what should be wrapped into groups (the beginning of the output is missing, anyway). To insert CDATA and change rid attributes, you can use XML::XSH2 in this way:
open 908451.xml ;
for $t in //title/text() insert cdata $t replace $t ;
for //article-ref/@rid
insert text xsh:subst(., '.*-2_' , '') replace . ;