Briefly imprisoned, Liu Xiang was terminated from his official position, and he received no new appointments to the office for the next fifteen years.
[3] The succession of Emperor Cheng to the imperial throne was accompanied by a realignment of power among the various factions involved in government, and Liu Xiang was able to revive his official prospects.
In 26 BCE, at the command of the emperor, Liu Xiang spent much of the rest of the 20-odd years of his life engaged in the massive bibliographic work of organizing the imperial library.
Liu compiled the first catalogue of the imperial library, the Abstracts (別錄, Bielu), and is the first known editor of the Classic of Mountains and Seas (Shanhaijing), which was finished by his son.
[citation needed] He has long erroneously been credited with compiling the Biographies of the Immortals (Liexian Zhuan), a collection of Taoist hagiographies and hymns.