子要素に子を挿入する必要があります。私は 2 人の子を持っています。最初の子はカット アンド ペーストして 2 番目の子に最初の子として挿入します。
xml:
<fn id="fn1_1">
<label>1</label>
<p>The distinguished as &#x2018;bisexuation.&#x2019;</p>
</fn>
私は試した
sub fngroup{
my ($xml_twig_content, $fn_group) = @_;
@text = $fn_group->children;
my $cut;
foreach my $fn (@text){
$cut = $fn->cut if ($fn->name =~ /label/);
if ($fn =~ /p/){
$fn->paste('first_child', $cut);
}
}
}
処理できません。ラベルを切り取り、ラベル タグを first_child として p タグに貼り付けるにはどうすればよいですか。
私は欲しい:
<fn id="fn1_1">
<p><label>1</label> The distinguished as &#x2018;bisexuation.&#x2019;</p>
</fn>