Paul, very nice example! I understand how the scripts work. I will definitely keep this example as a template for my future work.
Regarding my question, your xml script confirmed that the groups whose visibility toggle need to be marked with a getVisible statement in the xml file.
And, importantly, the scripts for those visibility toggling ribbon elements are in the xml file. But in the xml file in question I don't see the script for these visibility toggling ribbon elements.
I am now at home and it is weekend. I don't have the xml script with me. So, I can't show it to you now. I will get back to you early next week.