Conditional quantum-state transformation at a beam splitter