utils: minimize crossref code

* Squashes common code in get_crossref_content()
  function to minimize repetitions.

Signed-off-by: Pedro Gaudêncio <pedro.gaudencio@cern.ch>
Reviewed-by: Javier Martin Montull <javier.martin.montull@cern.ch>