How can I avoid violating the "single responsibility principle" when writing a class which should transform data from format A to format B? There are exactly two reasons for such a class to change, because specifications of both, format A and B can change.
So, I am new here, and post this with the caveat that I am stretching in proposing my answer.
It seems to me that One can only take concepts like the "Single Responsibility Priciple" so far. To me, the single responsibility of your transform class is to manage the translation of data from one format specification to another. Some thoughts:
In the strictest of terms, if one of the formats changes, you theoretically would still need the previous version of the format converter for converting legacy dat (backward compatibility). You never know when someone might not get the memo about the change in formats. Or you might run into a batch of data in format A v1 in the basement somewhere. Therefore, the single responsibility of your class would remain the conversion of data from format A1.0 to format b1.0.
If one of the specifications DOES change, you now have to create a new VERSION of your class, right? Let's say someone modifies the spec for format A. Now you need a class which manages the transformation of data from format A1.1 to B1.0. You have created a new class with a single responsibility.
While in the scope of your project, you may not consider the need for backward compatibility a requirement, in terms of the SRP concept, my understanding is that a change in one or both of the format specs requires the definition of a new class, and does not, in the strictest terms of the acedemic theory, imply more than one responsibility.
Lastly, if you think of the mapping of data from one format to another as the single responsibility of the class, then a change to EITHER spec still only necessitates a change to the single job of the class.
A final example by illustration. Assume the responsibility of my class is to transform a particular shade of red into a particular shade of pink. Then one day the cheif designer decides he wants a brighter pink as the output, one side of my spec has changed, but the responsibility of my class has not. The next day, it is decided at the very highest corporate level that the new red standard is more like maroon. Now my input spec has changes, but the responsibility of my class has not. I might decide the create a new class, and retain version 1.0 for holdovers, or I might just update the existing version. In either case, the class still has a single responsibility; mapping the red specification to the pink specification.