Problems implementing custom XSL

19 views
Skip to first unread message

Anthony Bradburn

unread,
Nov 1, 2022, 7:35:12 PM11/1/22
to PreTeXt support
Ultimately my goal is to set custom page margins. I have done so successfully in the past, but something seems to have broken.

When I follow the guide as outlined below, the build fails with several undeclared variable errors.

Here is what I have done:

Pretext CLI version 1.0.5

Issue command: 'pretext new book'
Issue command 'cd new-pretext-project'
Issue command: 'pretext build print'
Everything Okay.

Begin Customizing XSL
Following guide here: https://pretextbook.org/doc/guide/html/processing-thin-xsl.html and example xsl files here: https://github.com/PreTeXtBook/pretext/tree/dev/xsl
Modify project.ptx. Add '<xsl>xsl/custom-latex.xsl</xsl>' to the '<target name="print" pdf-method="xelatex">' node.
Issue command: 'mkdir xsl'
Create file @ ./xsl/custom-latex.xsl with contents:

    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
        xmlns:exsl="http://exslt.org/common"
        xmlns:str="http://exslt.org/strings"
        extension-element-prefixes="exsl str"
        >
    <xsl:import href="./core/pretext-common.xsl"/>
    </xsl:stylesheet>


Issue command 'pretext build print'.
Build fails:
*----*
PreTeXt project found in `/home/jupyter-abradburn/test/new-pretext-project`.
warning: Assets like latex-images will not be regenerated for this build
warning: (previously generated assets will be used if they exist).
warning: To generate these assets before building, run `pretext build -g`.
Building with custom xsl /home/jupyter-abradburn/test/new-pretext-project/xsl/custom-latex.xsl specified in project.ptx
Preparing to build into /home/jupyter-abradburn/test/new-pretext-project/output/print.

Now building LaTeX into /home/jupyter-abradburn/test/new-pretext-project/output/print

discovering source file's directory name: /home/jupyter-abradburn/test/new-pretext-project/source
verifying and expanding input directory: /home/jupyter-abradburn/test/new-pretext-project/source/../generated-assets
input directory expanded to absolute path: /home/jupyter-abradburn/test/new-pretext-project/generated-assets
verifying and expanding input directory: /home/jupyter-abradburn/test/new-pretext-project/source/../assets
input directory expanded to absolute path: /home/jupyter-abradburn/test/new-pretext-project/assets
converting /home/jupyter-abradburn/test/new-pretext-project/source/main.ptx to LaTeX as /tmp/tmpr1jztho0/main.tex
XSL conversion of /home/jupyter-abradburn/test/new-pretext-project/source/main.ptx by /tmp/tmpxxif_n02/custom-latex.xsl
comprehensive messages, warnings, and errors:
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'inline-hint-main' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'inline-hint-back' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'docinfo' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'docinfo' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
    * runtime error, element 'variable'
    * Variable 'document-root' has not been declared.
    * Undefined variable
    * runtime error, element 'variable'
    * Evaluating global variable  var/param being computed failed
processing with /tmp/tmpxxif_n02/custom-latex.xsl has failed

critical: Evaluating global variable  var/param being computed failed
##################
Failed to build pdf.  Exiting...

----------------------------------------------------
While running pretext, the following errors occured:

critical: Evaluating global variable  var/param being computed failed

----------------------------------------------------
*--*

A diff of the /tmp/tmpxxif_n02/core/pretext-common.xsl file and the one found here: https://github.com/PreTeXtBook/pretext/tree/dev/xsl indicates that they are identical.

The error messages indicate that the custom-latex.xsl is loaded, and imports the pretext-common.xsl as expected. However, something isn't being handled correctly.

If I am doing something incorrectly, can someone point me at the proper documentation? Thank you for any help.

Rob Beezer

unread,
Nov 1, 2022, 7:54:31 PM11/1/22
to pretext...@googlegroups.com
Dear Anthony,

Well, the documentation has changed:

https://pretextbook.org/doc/guide/html/processing-thin-xsl.html

still exists on the server, but if you start at the top of the Guide, you won't
find it in the Table of Contents (my mistake to have left laying around, just
last week).

The reason it is gone is that things like margins for LaTeX are much easier now.
This was announced on pretext-announce a few days ago:

Section 30.5: Page Shape
https://pretextbook.org/doc/guide/html/page-shape.html#page-shape

So I don't have answer about why you get the failures you do (maybe the CLI
folks can tell), but the variables failing look like a failure to run the
pre-processor step (xsl/pretext-assembly.xsl).

Short answer: we are trying to make custom XSL unnecessary.

Rob



On 11/1/22 16:35, Anthony Bradburn wrote:
> Ultimately my goal is to set custom page margins. I have done so successfully in
> the past, but something seems to have broken.
>
> When I follow the guide as outlined below, the build fails with several
> undeclared variable errors.
>
> Here is what I have done:
>
> Pretext CLI version 1.0.5
>
> Issue command: 'pretext new book'
> Issue command 'cd new-pretext-project'
> Issue command: 'pretext build print'
> Everything Okay.
>
> Begin Customizing XSL
> Following guide here:
> https://pretextbook.org/doc/guide/html/processing-thin-xsl.html and example xsl
> files here: https://github.com/PreTeXtBook/pretext/tree/dev/xsl
> Modify project.ptx. Add /'<xsl>xsl/custom-latex.xsl</xsl>/' to the '/<target
> name="print" pdf-method="xelatex">/' node.
> Issue command: 'mkdir xsl'
> Create file @ ./xsl/custom-latex.xsl with contents:
>
> /    <?xml version='1.0'?>
>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
>         xmlns:exsl="http://exslt.org/common"
>         xmlns:str="http://exslt.org/strings"
>         extension-element-prefixes="exsl str"
>         >
>     <xsl:import href="./core/pretext-common.xsl"/>
>     </xsl:stylesheet>/
>
> Issue command 'pretext build print'.
> Build fails:
> *----*
> /PreTeXt project found in `/home/jupyter-abradburn/test/new-pretext-project`.
> critical: Evaluating global variable  var/param being computed failed/
> ----------------------------------------------------
> *--*
>
> A diff of the /tmp/tmpxxif_n02/core/pretext-common.xsl file and the one found
> here: https://github.com/PreTeXtBook/pretext/tree/dev/xsl indicates that they
> are identical.
>
> The error messages indicate that the custom-latex.xsl is loaded, and imports the
> pretext-common.xsl as expected. However, something isn't being handled correctly.
>
> If I am doing something incorrectly, can someone point me at the proper
> documentation? Thank you for any help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/2122ac21-4d18-44a8-be37-121295de01e9n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/2122ac21-4d18-44a8-be37-121295de01e9n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages