Sry, I apologize profuciously. I will, as required by the internet and the rules of these fora, arrange to have myself flogged with a damp trout. And I will try to do better.
Have you run the small sleep example you provide and appreciated its behaviour?
Going_To_Sleep();
and anything you need to drag out of that example, the variables and the interrupt routine and so forth, are all you need.
Going_To_Sleep might better be named TakeANap. In any event, when you call it, it will not return until the processor is waked up.
So.
Put Going_To_Sleep(); in your code wherever you want. Wherever you want to have the processor go into low power mode. All functioning will cease right there at that point, only to continue when the interrupt signal on the pin assigned to it is invoked.
That's it. Put the thing to sleep wherever, and count on perfect continuation of the process you were in the middle of once the signal comes in.
I recommend that you use a pushbutton as a proxy for the touch switch until you get the sleep thing working. I don't know the touch switch you linked; ones I have used can be exciting enough to work with outside the kind of circumstances you seek to surround yours with.
Again, my sincere appy polly loggies, good luck w/ your project.
a7