Da-Tang kaiyuan li 大唐開元禮 "Ritual (Canon) of the Kaiyuan Reign of the Great Tang Dynasty" was compiled under the supervision of Xiao Song 蕭嵩 (d. 749), courtesy name Qiaofu 喬甫, style Tijun 體竣, who was Grand Preceptor of the Heir Apparent (taizi taishi 太子太師) and Director of the Palace Secretariat (zhongshu ling 中書令).
The chapter on rituals in Du You's 杜佑 (735-812), encyclopaedia Tongdian 通典 and these in the official dynastic histories Jiutangshu 舊唐書 and Xintangshu 舊唐書 explain that in the beginning of the Tang period 唐 (618-907), there were still no rules for rituals, and therefore, whenever important ceremonies were to be conducted, ad-hoc decisions were taken.
During the Kaiyuan reign-period 開元 (713-741) of Emperor Xuanzong 唐玄宗 (r. 712-755), secretarial receptionist (tongshi shangren 通事舍人) Wang Yan 王岩 submitted a memorial to the throne in which he pointed at the urgent need to compile a ritual code. It was to be based on the ceremonies described in the ancient Classic Liji 禮記, and to enriched with new rules.
Zhang Yue 張說 (667-730), academician of the Hall of Assembling Worthies (jixian xueshi 集賢學士), countered that it was not possible to change a non-printed (i.e. ancient) text like the Liji, and instead advocated to make use of the precedent cases on ceremonies formulated during the Zhenguan 貞觀 (627-649) and Xianqing 顯慶 (656-660) reign-periods. Emperor Xuanzong thereupon ordered right cavalier attendant-in-ordinary (you sanji changshi 右散騎常侍) Xu Jian 徐堅 (659-729) and left remonstrance official (zuo shiyi 左拾遺) Li Rui 李銳, as well as erudite-Chamberlain for Ceremonials (taichang boshi 太常博士) Shi Jingben 施敬本 to draft such a code. It was finished within a year's span.
Xiao Song, freshly-made academician (xueshi 學士) reported to the throne that imperial diarist (qiju sheren 起居舍人) Wang Zhongqiu 王仲邱 was about to revise and finish a set of rules of the five types of rituals (wuli 五禮) of the Tang dynasty. The result was the 150-juan long Kaiyuanli.
It is headed by a 3-juan long introduction into the topic, and then treats all five types of rituals, namely festivity rites (jili 吉禮), guest rituals (binli 賓禮), military ceremonies (junli 軍禮), congratulational rituals (jiali 嘉禮), and funeral rites (xiongli 凶禮). The repositioning of the funeral rites from the second to the last place follos the sequence in the rituals from the Zhenguan reign-period.
During the Zhenyuan reign-period 貞元 (785-804) Emperor Dezong 唐德宗 (r. 779-804) decided to include the canon among the textbooks for students aspiring to pass the state examinations. Officials of the Chamberlain for Ceremonials (taichang 太常) were used as instructors. The Kaiyuanli rites were used for the compilation of the Jiutangshu and Xintangshu as a source on Tang-period state rituals, yet unfortunately only thirty to fourty per cent of the original have survived.
Du You's Tongdian also lists a book kalled Kaiyuan lizuanlei 開元禮纂類, with a length of 35 juan, which seems to be a very different text than the official Kaiyuanli with another concept of arrangement.