I dont see why it wouldn't "work", the question is whether it would be worth doing. If you need this wide a range of gears it is probably worth going for a triple. Your main problem would be deraileurs. You may have difficulty getting both front and rear to co-operate with that wide a range on the front. Solutions for this would be either compact specific (or triple) front deraileur and a longer cage on the rear to pull up some of the excess chain tension. If you don't want to do this then you could just put the compact on and not use the extreme gears like 34x12 and 52x23.
BTW why do u want this wide a range of gearing?