{
ename = x.getAttributeText( "ref" );
if( ename.length() > 0 )
{
final XmlElement reftarget = elements.get( ename );
if( reftarget != null )
{
x.setAttributeText( "ref", null, true );
if( ! inlined.contains( ename ) )
{
final Element xdom = x.getDomNode();
for( XmlElement refTargetContentElement : reftarget.getChildElements() )
{
final Element idom = (Element) document.importNode( refTargetContentElement.getDomNode(), true );
xdom.insertBefore( idom, null );
}
x.setAttributeText( "name", reftarget.getAttributeText( "name" ), false );
x.setAttributeText( "type", reftarget.getAttributeText( "type" ), false );
changed = true;
}
}
}