If you have a real-valued function f(x), positive, continuous and bounded on some interval, then what kind of transform would convert this to a monotonic function g(x) on that interval analogously to sorting a discrete set of values ?

That is, if you approximate the function by a finite grid on the interval and sort the values, then take the limit as the step-size of the grid goes to zero.

The resulting monotonic function g(x) should start and end at the min and max of the original function f(x) and have that the definite integral of g(x) over a subinterval where the values of g(x) lie between s and t should be the same as the definite integral of f(x)(f(x)>=s)(f(x)<=t) over the whole interval where (f(x)>=s) is logic expression equal to 0 or 1.