Overview

The Koui Genji Monogatari (Collated Tale of Genji) Text Database publishes text data from “Koui Genji Monogatari.”

https://kouigenjimonogatari.github.io/

This time, I added PDF files like the following to the database.

https://kouigenjimonogatari.github.io/output/01/main.pdf

This article describes how to create such PDF files using XSLT and TeX.

Cloning the Repository

Clone the repository as follows.

gitclone-depth1https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io

Then install xslt3 with the following command.

npmixslt3

https://www.npmjs.com/package/xslt3

Creating the XSL File

This time, we first convert the TEI/XML file to a TeX file.

I created the following XSL file.

https://github.com/kouigenjimonogatari/kouigenjimonogatari.github.io/blob/master/xsl/tex.xsl

<<\\\\%\\%\\\\\%<<\\\\?xduuunnstdbmxxp/epp/xsxx<<ossseeeiaeassaxn<<e<<lxmlmmxxceeewwtttgkllrsd/!xr!xasl:llssupppccmleie::\l{x-ss-sclsnnllmaaaooae{ntfam:ds-lo-le:vtss::ecccmmi{}{iopefol:n:{sey::otnkkkmmn<dtrpdoc:t{t<trlxtuetaaaaajxol-lsrute<exysesetmcgggnnfsceeyk-memxmslislippleeeddolua-ieempspleoh==ula{{[{{n:mctpanplll:sne""tasxlt\\tvehectla:avh=ehhtscuopp{anmh}atvtae"tttme[oapelNltsp>teaele1ttealt=raou}elelut.vpptm4oe2sctela>mume>0e::haprxcoeo-etaea-"r/ota}jmn}ocet-tos/dcpa,}[Sftscocfeiww=he-b[1e=/hfhnoww"=rfo1]rs">==scnwwt",ot]{ie/"s"eo=..e/1nt{\fl/tetld"wtx"1to\teteleei13et>psmteCceieicn..i"tp=exJti:c:tg0o-,e2xtK=:ptp=="rcelccti"se=l""g.na}mbtJ/er"a.Uocn,f{P/gs.c"T1rod%l{\}t"N"e/F9gdsece>a/N>-9/icffc%im>a}89nnaotol:e}m<"/sgpn=lot"<e/?X/=et2ori>/"x>S1"]scr{tx>sL.U{pm{glsl0Tle,brel:T"Ftcrle":tr>-jiue/tea8tgen>emn"ah}}}mps/rLt##plf>tu=11laoia2}}atrcTc}}temleme>"eX,>}-tjeaxtwidth=25cm]{geometry}

Using the previously installed xslt3, you can convert the TEI/XML file to a TeX file as follows.

npxxslt3-xsl:xsl/tex.xsl-s:xml/xsl/01.xmlo:output/01/main.tex

An excerpt of the converted TeX file is shown below.

\\\\%\\%\\\\\%\duuunnstdbmppossseeeiaeaaaceeewwtttgkrrupppccmleie\\maaaooae{ntmmecccmmi{}{ieenkkkmmndtddtaaaaajolsscgggnnfcekkleeeddouiia{{[{{nmppsxlt\\tescuopp{n[oapelNtalt=rao}4oe2sctprxcoeoa}jmn}}pa,}[Se-b[1erfo1]r,ot]{i1nt{\f1to\tpsmteCtp=exJ,e2xtKlcctia}mbtJn,f{Pd%l{\}seccffc%aotolpn=loet2or]scr{{pm{gle,brtcrlejiuetgenah}}rLt##tu=11ia2}}cTc}}lemeX,}-tjeaxtwidth=25cm]{geometry}

Creating the PDF File

Convert the TeX file to a PDF file using the following command.

lualatexoutput-directory=output/01main.tex

Additionally, to use the Noto Serif CJK JP font on macOS, the following was necessary.

brewinstall-caskfont-noto-serif-cjk

Summary

In the following article, I created an HTML file that enables side-by-side display with IIIF images from the same TEI/XML file used in this article.

In this way, one advantage of creating text in TEI/XML is the ability to produce output tailored to different purposes using XSLT.

My understanding of TeX is still limited in many areas, but I hope this serves as a useful reference for working with TEI/XML.