This code looks conceptually correct, but perhaps it is redundant.  Have you verified that "len(self.inputs.transforms)" is 2 when self.inputs.collapse_output_transforms = True?