if (newParent.getName() != null) {
// new parent is not null named, and will appear in the
// output, therefore the styles can be pushed up
StylesMerger merger = StylingFactory.
getDefaultInstance().getStylesMerger();
newParent.setStyles(merger.merge(styles,
newParent.getStyles()));
} else {
// the new parent is null named, and will not appear in
// the output, so the styles should be pushed down to
// be preserved. merge the element's styles with those