How to stack/layer two textures with alpha over each other with Material nodes? I have two textures with transparency and I want them on top of each other with a Diffuse shader below them via the Material nodes in Cycles.





Because I'm using the Material nodes and not the Compositor, I can't just simply use the Alpha Over node.

Here's as far as I got. (Ambient Occlusion is enabled. I need both textures at full opacity.)



My problem seems to be stemming from the fact that I don't know how to combine alpha channels, if that helps.

How do I do this? 

(It MUST be done in the Materials node editor.)

Here's the .blend file:
The alpha channel of both images can be combined ( in this case  it works if you add them, but you can also do other operations depending on your needs) and used to control the mix for the colors or shaders:



or: