Peel, core and chop the apples or top, tail and chop the gooseberries. Place with the onions, garlic and a little water in a pan and cook, uncovered, until soft. Add all the remaining ingredients to the pan, bring to the boil and stir until the sugar has dissolved. Simmer gently until the desired consistency is reached. Pour into warmed sterilised jars, cover and label.