Roll out the pastry into a rectangle about 25cm/10in by 20cm/8in.
Heat the butter in a frying pan, and add the onion, cooking until it is softened but not coloured.
In a mixing bowl, combine the onion and the sausage meat well.
Put the sausage mixture down the middle of the long length of the pastry. With a sharp knife, cut slits 3cm/1in apart, 1cm/½in away from the sausage mixture to the edge of the pastry, slanting away from you. Brush with beaten egg.
Starting at the end nearest to you, fold the pastry alternately over each other, to give a 'plait' effect. Brush the top with beaten egg.
Transfer to a baking tray and bake in the centre of the oven for 40 minutes, reducing the temperature to 150C/300F/Gas 2 after 20 minutes. Serve in slices hot or cold.