There are various approaches that you can use to build your Top Navigation. I can't give yu a full solution on this forum but here are a few thoughts to get started. I am going to assume that you can use presentation API to build your application.
- Execute a seperate N=0 with all dimensions exposed and use the navigation object to build your top menu. Note that exposing all refinements is expensive and if you have hierarchical dimension then all the nodes will not be exposed at the same time. Cache the menu at a session or application level if possible.
- If you have hierachical dimension then you might want to build an offline process that executes a seperate query for each node and builds and caches the entire top menu. It might not be a bad idea to do this offline (after baseline or partials) and store the results as xml or json that your application can then use to construct the menu.
- If you are not using the Url Optimization API then you can also use the actual dimension xml to build your menu. This will be a bit more complicated if autogen and external dimensions are to be included but is an option.
I am sure one can come up with other alternatives but in general try to build your menu and cache it. Also keep in mind that the process can get more complecated if you have record filters and roles or other parameters to consider.