I've defined an aspect, let's say 'pre:sample' and it has one mandatory aspect that is 'pre:another'. I've applied 'pre:sample' to a node and as I expected, Alfresco applied 'pre:another' to the node. But when I've removed 'pre:sample' aspect from the node, I saw 'pre:another' aspect is still applied to he node. How can I make Alfresco to remove mandatory aspect(s) of an aspect when it is removed?
You would have to do that with a policy OnRemoveAspect. If you know java, that is probably the best option, but you can create javascript based policys as well. For javascript, check the test scripts here.