Preheat the oven to 200°C (400°F).
Place the onions in a heatproof bowl and cover with just-boiled water. Leave for 10 minutes to soften slightly, then drain well and stand on a tray lined with paper towel to dry.
On a lightly floured work surface, stack both pastry sheets on top of each other. Using a rolling pin, roll the pastry out to a rough 26 cm (10½ inch) square. Transfer to a tray and chill until required.
Place the sugar and ¼ cup (60 ml) water in a 23 cm (9 inch) ovenproof frying pan or skillet over medium heat. Cook, swirling constantly, until the sugar dissolves. Increase the heat to high and leave to cook without disturbing for 5 minutes, or until you blink and it’s suddenly turned into a golden caramel.
Remove from the heat. Carefully – the mixture will sizzle! – add the wine, vinegar, butter, pepper, anchovies and herbs of choice. Return to the boil and swirl to combine.
Carefully arrange the onions over the hot caramel so that they are tightly packed, then place the pastry over the top, tucking the edges in to give you a cool rustic edge on the flip-side.
Bake for 30 minutes, then remove from the oven and cover with foil to prevent burning. Return to the oven and bake for a further 30 minutes, or until the pastry is cooked through and the caramel is bubbling.
Remove from the oven and leave to stand for 10 minutes.
To serve, place a flat plate over the pan, then carefully invert the tart. Scatter with salt flakes and cracked black pepper, some crumbled cheese and fresh herbs.