Preheat the oven to 350˚F. In a heavy saucepan over high heat, melt the butter or oil. Add the onions and stir to coat with the butter or oil, then cover for about five minutes. This will help to draw some of the moisture out from the onions. Then, uncover, add the salt and turn the heat to low. Continue to cook the onions, stirring occasionally, until the onions are medium-brown and caramelized, about 30 minutes.Sprinkle the top of the onions with the flour and stir thoroughly to coat. Add the wine and Cognac. Once the alcohol has evaporated slightly, add the hot stock. Reduce heat, add bouquet garni and simmer for one hour uncovered.
Meanwhile, toast the baguette slices. Just before serving, top one side of the bread slices with cheese and broil lightly until cheese slightly melts. Remove bouquet garni and ladle soup into four broiler-safe bowls, such as heavy crockware.
Taste the soup, adding more salt if needed. Put the toasts into the soup, cheese side down. Top the soup and bread with a layer of gruyere, topping off with a bit of Parmesan. Bake for 15 minutes, and then put under a broiler for a couple of minutes until the cheese bubbles and browns.