The replacement of silica involves two processes:  
1) Dissolution of rock minerals 
2) Precipitation of silica
It could be explained through the carbonate-silica replacement. Hydrothermal fluids are undersaturated with carbonates and supersaturated with silica. When carbonate rocks get in contact with hydrothermal fluids, due to the difference in gradient, carbonates from the original rock dissolve into the fluid whereas silica precipitate out of it. The carbonate that dissolved is therefore pulled out from the system while the silica precipitated recrystallizes into various silicate minerals, depending on the silica phase. The solubility of silica strongly depends on the temperature and pH value of the environment where pH9 is the controlling value. Under a condition of pH lower than 9, silica precipitates out of the fluid; when the pH value is above 9, silica becomes highly soluble.