With the new details you specified, you task becomes more complicated.
If your task is strictly bound to a dynamic list, you will not be able to solve it with the query language only.
For instance, you can additionally use a register with a string or Ref dimension for the full path to an item in the catalog and a resource for the item's path representation in the desirable format. First, you populate the register with the catalog item data and then you retrieve the data to the dynamic list according to the register via the left join in the query. The key point to consider is the way you update the register with the changes in the catalog items (for instance, upon the event of posting changes to the catalog).
Alternatively, instead of the dynamic list, you can use the data composition system (DCS) report. With DCS, you can create your custom function that processes the query results in the way you need.