We present long-slit spectroscopy of a sample of 31 QSO and radio galaxies, mostly selected on the basis of their X-ray and radio properties, in order to investigate any similarity of their surrounding nebulosity to emission-line gas around cooling flow galaxies at lower redshift. Nine objects (five QSO) show extended oxygen emission. For eight of these, a measurement or limit of the ratio of the redshif ted [O III] λ5007/[O II] λ3727 emission lines in the nebulosity is made, after removal of any spillover light from the nucleus. The ratio is compared with that expected from gas at the observed radius photoionized by the active nucleus in order to determine the density, and hence pressure, of the gas. The sample is extended by including observations of similar objects from other work. Of the extended objects modelled, seven are consistent with the cooling flow hypothesis, displaying either an [O III]/[O II] ratio compatible with nearby cooling flows, or requiring high-density emission-line gas. Three objects, two of which are radioquiet QSO, do not require a high gas density. The X-ray luminosity of the third galaxy with low density extended gas is unknown.