概要

校異源氏物語テキストDBは、『校異源氏物語』のテキストデータを公開するデータベースです。

https://kouigenjimonogatari.github.io/

今回、本DBに以下のようなPDFファイルを追加しました。

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

本記事は、上記のようなPDFファイルを、XSLTとTeXを使って作成します。

リポジトリのクローン

以下のように、リポジトリをクローンします。

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

そして以下のコマンドにより、xslt3をインストールします。

npmixslt3

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

XSLファイルの作成

今回は、まずTEI/XMLファイルをTeXファイルに変換します。

以下のようなXSLファイルを作成しました。

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}

先にインストールしたxslt3を使って、以下のようにTEI/XMLファイルをTeXファイルに変換できます。

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

変換したTeXファイルの例(一部)は以下です。

\\\\%\\%\\\\\%\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}

PDFファイルの作成

以下のコマンドにより、TeXファイルをPDFファイルに変換しました。

lualatexoutput-directory=output/01main.tex

また、Noto Serif CJK JPフォントの利用に当たり、macOS環境において、以下を行う必要がありました。

brewinstall-caskfont-noto-serif-cjk

まとめ

以下の記事では、今回の記事で対象とした同じTEI/XMLファイルから、IIIF画像との対照表示が可能なHTMLファイルを作成しました。

このように、XSLTにより、用途に応じた出力を行うことができる点がTEI/XMLでテキストを作成する利点の一つかと思います。

TeXについて理解が乏しい点が多々ありますが、TEI/XMLの利用にあたり、参考になりましたら幸いです。