Skip to main content

The PreTeXt Guide

Section N.4 Updating your custom XSL

Because the PreTeXt-CLI uses its own copy of PreTeXt, we have to change how the custom XSL imports the PreTeXt style sheets.
At time of writing, import of the entities.ent file, which defines all the different components of PreTeXt, does not seem to work automatically. Our first step will be to make a copy of this file, and place it in the xsl folder, next to our custom XSL style sheet.
If you still have a copy of the PreTeXt repository, you can copy entities.ent from pretext/xsl. If not, open a Python terminal, and then run:
from pretext import static
static.core_xsl('pretext-latex.xsl',as_path=True)
This will output the path to the PreTeXt XSL, and in that folder you can find entities.ent and copy it to PROJECT-CLI/xsl.
Next, open your custom XSL file. You will need to change two lines. First, you will have a line that looks something like
        <!ENTITY % entities SYSTEM "../xsl/entities.ent"/>
      
Change the string ../xsl/entities.ent to simply entities.ent. (Alternatively, instead of copying this file as above, you could enter the full path.)
Second, for each style sheet that you import, you will have a line that looks something like
        <xsl:import href="../xsl/pretext-latex.xsl"/>
      
if you are using custom XSL for LaTeX. Replace href="../xsl/pretext-latex.xsl" with pretext-href="pretext-latex.xsl" . This tells the PreTeXt-CLI to import the XSL style sheet that it ships with.