We present a method for generating exact interior solutions of Einstein's
equations in the case of static and axially symmetric perfect-fluid spacetimes.
The method is based upon a transformation that involves the metric functions as
well as the density and pressure of the seed solution. In the limiting vacuum
case, it reduces to the Zipoy-Voorhees transformation that can be used to
generate metrics with multipole moments. All the metric functions of the new
solution can be calculated explicitly from the seed solution in a simple
manner. The physical properties of the resulting new solutions are shown to be
completely different from those of the seed solution