Peel onions, and trim the tops and bottoms so that they are flat on both ends. Cut the onions in half horizontally and put in a casserole or baking dish.
Pour the vegetable stock and olive oil over them, then season with the rosemary, salt and pepper. Bake uncovered for 50 minutes, basting the onions occasionally.
Remove from oven, put the onions on a plate, and pour the sauce into a saucepan. Bring to a boil, then remove from the heat and whisk the butter in.
Put onions back in casserole dish, pour the sauce over them and put back in the oven until they are very tender to a fork and have a shiny glaze -- about 20 minutes. You may want to baste once or twice. Serve hot.
Notes
Instead of dried rosemary, you can use 4 fresh sprigs, chopped.If you don't have Spanish onions, try very large white or red onions.