PHP - 多次附加DOMNode

Please let me first explain the following situation. I'm having this markup, serving as my template:

<div class="container">
    <div class="item"></div>
</div>

Now what i want to do is simply grabbing the '.item' node, copy it, add some value to it and append it to '.container'(its parent). And repeat this process for several times. This is how the result should look like:

<div class="container">
    <div class="item">Happy</div>
    <div class="item">New</div>
    <div class="item">Year</div>
    <div class="item">2015</div>
</div>

I accomplished this with the following code:

$child = $node->childNodes->item(0);    
$refNode = $child;
$template = $child->cloneNode(true);

for($i=0; $i < 4; $i++){ 
    $refNode = ($node->lastChild === $child)?
                $node->appendChild($child): 
                $node->insertBefore($child, $refNode->nextSibling); # (newNode, refNode)

    $refNode->nodeValue = walk($data);
    $child = $template->cloneNode(true);
}

function walk(&$array){
    $item = current($array); next($array); return $item;
}

This works fine. However, I'm not satisfied with this code.

I was expecting this could be done in a simpler fashion, something like this:

$refNode = $node->childNodes->item(0)->cloneNode(false); # copy the child node
$node->nodeValue = null; # empty the container

for($i=0; $i < 4; $i++){ 
    $refNode->nodeValue = walk($data); # assign value to the reference node
    $node->appendChild( $refNode ); # append 
}

This, sadly, doesn't work.

So, my question is, is there an easier and more elegant way to do this?



EDIT

Ok, this will work:

$child = $node->childNodes->item(0); # copy the child before removing
$refNode = $child; # make a reference
$node->nodeValue = null; # empty parent

for($i=0; $i < 4; $i++){  
    $refNode->nodeValue = walk($data); # assign value to reference node
    $child = $refNode->cloneNode(true); # copy reference node
    $node->appendChild($child); # append to parent
}

Although I'm still not quite sure why i simply cant re-append a child node. Maybe because it's already appended, therefore not available for adding anymore and this is why i have to make a reference node?