Hi,
Unfortunately, I am not sure if I understand your goal. According to your solution it seems that you needed to select documents from second level dynamically.
Just for information - following article about
path expressions might be useful for you next time. You could set the Path property of menu webpart to work according to the current path.
For example:
/{0}/{1}/% - returns all documents under the second level of the current path
Best regards,
Ivana Tomanickova