You can insert the following macro to the Path property of your source web part (e.g. Repeater web part). This macro can be used when you want to display either the child documents of the current document if they exist, or else, display the sibling documents of the current document when no child documents exist for the current document.
{%
if (CurrentDocument.Children.Count > 0) {
return "./%";
}
else {
return "../%";
}
#% }
When copying this macro example, please remove the space between the closing percent and bracket characters.
-jh-