Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admonition graphics does not render to pdf with custom STYLEROOT #719

Open
kalimalrazif opened this issue Nov 10, 2023 · 16 comments
Open

Admonition graphics does not render to pdf with custom STYLEROOT #719

kalimalrazif opened this issue Nov 10, 2023 · 16 comments
Assignees

Comments

@kalimalrazif
Copy link

Problem description

I created a custom style sheet inside the xslt/fo directory and enabled graphical admonitions and draft mode, but even though I created the static/images directory inside xslt/fo, neither the draft watermark nor the graphical admonitions are displayed. 😢

Got this output:

❯ daps -vvvv -d DC-QPortal-Producto-HLD pdf --remarks
---------------

        DAPS VERSION: 3.3.2

             DOC_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD
           BUILD_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build
            DAPSROOT: /usr/local/daps/share/daps
             DOCCONF: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/DC-QPortal-Producto-HLD
                BOOK: QPortal-Producto-HLD


     DOCBOOK_VERSION: 5
        DOCBOOK5_RNG: /usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
        DBSTYLE_VERS: 1.79.1

           STYLEROOT: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xslt
      STYLEROOT_VERS: Not available
  FALLBACK_STYLEROOT: /usr/share/xml/docbook/stylesheet/docbook-xsl-ns
   FB_STYLEROOT_VERS: 1.79.1
            EPUB_CSS:
            HTML_CSS:

       PDF FORMATTER: fop
[warning] /usr/bin/fop: JVM flavor 'sun' not understood
   FORMATTER VERSION: FOP Version 2.4
   FORMATTER WRAPPER: /usr/local/daps/share/daps/libexec/daps-fop
    FORMATTER CONFIG:

            MAKE_CMD: /usr/bin/remake -f /usr/local/daps/share/daps/make/selector.mk --debug=b -j1 pdf
       XSLTPROCESSOR: /usr/bin/xsltproc
   XML_CATALOG_FILES: /etc/xml/catalog

---------------

Reading makefiles...
Updating goal targets....
 File 'pdf' does not exist.
   File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf' does not exist.
     File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/QPortal-Producto-HLD_remarks-fop_color_es.fo' does not exist.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/MAIN-QPortal-Producto-HLD.xml' does not exist.
         File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks' does not exist.
        Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks'.
mkdir -p /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks
        Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks'.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/MAIN-QPortal-Producto-HLD.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/MAIN-QPortal-Producto-HLD.xml   \
  --stringparam "filename=MAIN-QPortal-Producto-HLD.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xml/MAIN-QPortal-Producto-HLD.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/MAIN-QPortal-Producto-HLD.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter1.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter1.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter1.xml   \
  --stringparam "filename=chapter1.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xml/chapter1.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter1.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter2.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter2.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter2.xml   \
  --stringparam "filename=chapter2.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xml/chapter2.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter2.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter3.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter3.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter3.xml   \
  --stringparam "filename=chapter3.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xml/chapter3.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter3.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter4.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter4.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter4.xml   \
  --stringparam "filename=chapter4.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xml/chapter4.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/chapter4.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/.validate' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/.validate'.
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/.validate'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp'.
mkdir -p /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp'.
    Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/QPortal-Producto-HLD_remarks-fop_color_es.fo'.
/usr/local/daps/share/daps/libexec/daps-xslt --xinclude --param "show.comments=1" --param "generate.permalink=0" --param "ulink.show=1" --stringparam "draft.mode=yes" --stringparam "styleroot=/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xslt/fo/" --param "format.print=0" --stringparam "img.src.path=/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.images/color/" --param "fop1.extensions=1" --param "xep.extensions=0"   \
      --stringparam "converter.name=DAPS" --stringparam "converter.version=3.3.2" --stringparam "converter.url=https://opensuse.github.io/daps"   \
     --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/QPortal-Producto-HLD_remarks-fop_color_es.fo --stylesheet /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xslt/fo/docbook.xsl \
    --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.profiled/noprofile_remarks/MAIN-QPortal-Producto-HLD.xml /usr/bin/xsltproc  \
    ;
Making portrait pages on USletter paper (8.5inx11in)
    Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/QPortal-Producto-HLD_remarks-fop_color_es.fo'.
     File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/static' does not exist.
    Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/static'.
(cd /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp && ln -sf /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/xslt/fo/static)
    Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/static'.
  Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf'.
(cd /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/ && /usr/local/daps/share/daps/libexec/daps-fop /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/.tmp/QPortal-Producto-HLD_remarks-fop_color_es.fo /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf  )
[warning] /usr/bin/fop: JVM flavor 'sun' not understood
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:16333)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:17348)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:18361)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:19367)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:20372)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:21379)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:22379)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:23386)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:24395)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:25397)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:26403)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:27411)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:28412)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:29418)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:30426)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:31427)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:32434)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:33443)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:34445)
[WARN] FOUserAgent - Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
[WARN] FOUserAgent - Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
[WARN] FOUserAgent - Hyphenation pattern not found. URI: es.
[INFO] FOUserAgent - Rendered page #1.
[INFO] FOUserAgent - Rendered page #2.
[ERROR] FOUserAgent - Image not found. URI: images/warning.png. (See position 18:472)
[ERROR] FOUserAgent - Image not found. URI: images/warning.png. (No context info available)
[INFO] FOUserAgent - Rendered page #3.
[INFO] FOUserAgent - Rendered page #4.
[INFO] FOUserAgent - Rendered page #5.
[INFO] FOUserAgent - Rendered page #6.
[INFO] FOUserAgent - Rendered page #7.
[INFO] FOUserAgent - Rendered page #8.
  Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf'.
   File 'list-images-multisrc' does not exist.
  Must remake target 'list-images-multisrc'.
  Successfully remade target file 'list-images-multisrc'.
   File 'list-images-missing' does not exist.
  Must remake target 'list-images-missing'.
  Successfully remade target file 'list-images-missing'.
Must remake target 'pdf'.
pdfinfo /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf > /dev/null 2>&1 || ( ccecho "error" "PDF /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf has a size of 0 bytes"; false )
PDF book built with REMARKS=1, DRAFT=yes and META=0:
/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-HLD/build/QPortal-Producto-HLD/QPortal-Producto-HLD_remarks_color_draft_es.pdf
Successfully remade target file 'pdf'.

Expected behavior

The expected behavior is the pdf with draft watermark and graphics admonitions

Steps to reproduce problem

Create a xslt/fo/docbookc.xsl enable graphic admonitions
Create xslt/fo/static/images (a symbolic link to /usr/share/xml/docbook/stylesheet/nwalsh/images)
Just in case create xslt/fo/images (a symbolic link to /usr/share/xml/docbook/stylesheet/nwalsh/images)
Edit DC file and add:

STYLEROOT="xslt"
FALLBACK_STYLEROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl-ns"

Run:
daps -vvvv -d DC-QPortal-Producto-HLD pdf --remarks

What am I doing wrong?

Thanks in advance
Nomar

@kalimalrazif
Copy link
Author

With no custom xslt and this command line:
daps -vvvvvvv -d DC-QPortal-Producto-HLD pdf --remarks --stringparam "admon.graphics=1"

Got the expected result but I want to make more style changes and running all from string param will difficult collaborative work.

Thanks in advance
Nomar

@fsundermeyer
Copy link
Member

@tomschr Any ideas?

@kalimalrazif
Copy link
Author

From what I have been able to see when the custom style sheet is not used, the two links are created within build/.tmp directory, the makefile creates static and images links, but with the custom sheet only the static link is created

@kalimalrazif
Copy link
Author

Hi!

If I create the link to images within .tmp manually, the watermark and the admonition graphic are rendered correctly in the pdf document

@tomschr
Copy link
Collaborator

tomschr commented Nov 11, 2023

Hi @kalimalrazif,
thanks for your report!

From what I've seen your graphics are not found. You need to distinguish between two different types of graphics:

  • Images that are specific to the document. These are located in the images/ folder.
  • Static images that are used for every document. These contain logos, admon graphics, and others to give your document a distinctive look & feel.
    There is no predefined path, usually they are added in the same path as your XSLT customization layer. There are different parameters to set such paths like admon.graphics.path, img.src.path etc.

Relative paths can be tricky. 😉 You could use these strategies to investigate this issue further:

  1. Output these parameters in your customization XSLT layer. It looks like, the FO formatter searches these static images in a different paths.
  2. In the FO file, search for <fo:external-graphic src="..."/> elements. The url attribute contains the path. I'd assume that this path is wrong. With that knowledge, you could adapt your parameters.

Could you attach your custom XSLT stylesheet?

By the way, you've used DAPS 3. Although it still works, the more recent version is DAPS 4. Although it is in beta state, we use it daily and it works. Additionally, many bug fixes were added to version 4 plus it supports topic oriented writing with assemblies. Perhaps you should consider switching to DAPS 4.

@kalimalrazif
Copy link
Author

Hi @tomschr :-)

Sure, this is my stylesheet:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:d="http://docbook.org/ns/docbook">

    <xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/fo/docbook.xsl"/>

    <xsl:param name="section.autolabel" select="1"></xsl:param>
    <xsl:param name="section.autolabel.max.depth">5</xsl:param>
    <xsl:param name="admon.graphics" select="1"></xsl:param>
    <xsl:param name="admon.textlabel" select="1"></xsl:param>
    <xsl:param name="admon.graphics.extension">.svg</xsl:param>
    <xsl:param name="table.frame.border.thickness">
        <xsl:choose>
            <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
            <xsl:otherwise>1pt</xsl:otherwise>
        </xsl:choose>
    </xsl:param>
    <xsl:param name="table.cell.border.thickness">
        <xsl:choose>
            <xsl:when test="contains($stylesheet.result.type,'html')">1px</xsl:when>
            <xsl:otherwise>1pt</xsl:otherwise>
        </xsl:choose>
    </xsl:param>
</xsl:stylesheet>

In my case it would be the second situation. The watermark of the draft, and the graphics of the admonitions.

When I started, I created the stylesheet and only enabled the admonition graphics. When I wanted to render the pdf the file not found messages started. Investigating the error messages I saw that I needed a static directory inside the xslt/fo directory, because that directory was linked inside the .tmp directory when the pdf was created. I created the directory and then reading a little more I realized that I had to link or copy the standard images directory into the static directory. But the file not found messages remained.

Doing a little more research I deactivated my style sheet and activated the graphics via stringparam and voila the graphics appeared. I then took on the task of seeing what was happening. And I realized that with the stringparams, make created a static directory and linked the standard images inside it and then linked the images again in the .tmp directory. So I put my own link to the images inside my fo directory but the makefile ignored that directory.

If I, using my style sheet, manually link the standard images directory into the .tmp directory, everything works perfectly. Which tells me that the makefile should automatically link the images directory (standard or those inside my fo directory) in the .tmp directory.

Oh excellent, I'm going to change to version 4 then and try to see if the situation is resolved :-)

Thank you very much in advance

@kalimalrazif
Copy link
Author

kalimalrazif commented Nov 11, 2023

Hi!

I tried with version 4 and the behavior is maintained, if I manually link the standard images directory (admonitions, callouts, drafts, etc.) inside the build/.tmp directory the rendering works perfectly, otherwise it does not work. It shows neither the watermark nor the graphics of the warnings.

Which tells me that either the makefile has to link the standard images directory of the distro to the directory inside the build/.tmp directory or it must link the images directory that is inside the xslt/fo/ directory to the build/.tmp directory.

Again, thanks in advance :-)

@tomschr
Copy link
Collaborator

tomschr commented Nov 12, 2023

Ok, thank you @kalimalrazif!

It seems, DAPS doesn't copy the respective images. 🤔 I've tried to reproduce it and did the following steps. Maybe that helps you too:

  1. Create a test dir:

    $ daps-init --title="DAPS stylesheet example" --rootelement=article \
      --docbook5 --name="daps-stylesheet" --project-dir="/tmp/daps-xslt/"
    
  2. Create some directory structures for the stylesheets:

    $ cd /tmp/daps-xslt/
    $ mkdir -p xslt/{fo,xhtml,static/images}
    
  3. Download the image https://github.com/openSUSE/suse-xsl/tree/main/suse2022-ns/static/images/icon-note.svg and save it to xslt/static/images/note.svg. Do the same with the PNG image.

  4. Modify the DC-daps-stylesheet and insert the following changes:

    a. Search for "Custom stylesheets, option" and add:

    STYLEROOT="xslt/"

    b. At the end, add the following line:

    XSLTPARAM="--stringparam admon.graphics.path=${PWD}/xslt/static/images/"
  5. Store your FO customization to xslt/fo/docbook.xsl.

  6. Add a <note> block element in the first <section> element after the first paragraph:

    <note>
      <title>Fox and dog</title>
      <para>The quick brown fox jumps over the lazy dog.</para>
    </note>
  7. Build with daps:

    $ daps --debug -d DC-daps-stylesheet pdf

This should add an admonition note graphic in the PDF:

Screenshot_20231112_122651

This is the directory structure after the build:

$ /tmp/daps-xslt
$ tree
.
├── build
│   └── daps-stylesheet
│       ├── daps-stylesheet_en.pdf
│       └── log
│           └── make_pdf.log
├── DC-daps-stylesheet
├── images
│   └── src
│       ├── dia
│       ├── eps
│       ├── jpg
│       ├── pdf
│       ├── png
│       │   ├── example1.png
│       │   └── example2.png
│       └── svg
├── xml
│   └── MAIN-daps-stylesheet.xml
└── xslt
    ├── fo
    │   └── docbook.xsl
    ├── static
    │   └── images
    │       ├── note.png
    │       └── note.svg
    └── xhtml

17 directories, 9 files

Maybe there is an easier way to do that. It looks like that daps tries to create a link to the xslt/static directory:

Must remake target '/tmp/daps-xslt/build/.tmp/static'.
(cd /tmp/daps-xslt/build/.tmp && ln -sf /tmp/daps-xslt/xslt/static)
[...]

However, it's not there:

$ ls /tmp/daps-xslt/build/.tmp/
daps-stylesheet-fop_en.fo

@fsundermeyer Is this a bug or how is it supposed to work?

Perhaps this could be considered as an extension: if someone want to use a customization layer and the directory xslt/static/images/ exists, create a link to build/.tmp/.


Detailed log file of daps build (click me)
$ LANG=C daps --debug -d DC-daps-stylesheet pdf
---------------

        DAPS VERSION: 4.0.beta1

                BOOK: daps-stylesheet
                MAIN: /tmp/daps-xslt/xml/MAIN-daps-stylesheet.xml
           BUILD_DIR: /tmp/daps-xslt/build
            DAPSROOT: /usr/share/daps
             DOCCONF: /tmp/daps-xslt/DC-daps-stylesheet
             PRJ_DIR: /tmp/daps-xslt
             SRC_DIR: /tmp/daps-xslt/xml
         IMG_SRC_DIR: /tmp/daps-xslt//tmp/daps-xslt/images/src


     DOCBOOK_VERSION: 5
        DOCBOOK5_RNG: /usr/share/xml/docbook/schema/rng/5.2/docbookxi.rng
        DBSTYLE_VERS: snapshot

           STYLEROOT: /tmp/daps-xslt/xslt
      STYLEROOT_VERS: Not available
  FALLBACK_STYLEROOT: /usr/share/xml/docbook/stylesheet/nwalsh5/current
   FB_STYLEROOT_VERS: Not available
            EPUB_CSS: 
            HTML_CSS: 

       PDF FORMATTER: fop
   FORMATTER VERSION: Java virtual machine used: /usr/lib64/jvm/java/bin/java
classpath used: /usr/share/java/xmlgraphics-fop.jar:/usr/share/java/xmlgraphics-fop-hyph.jar:/usr/share/java/xmlgraphics-commons.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-io.jar:/usr/share/java/batik-all.jar:/usr/share/java/fontbox.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/xml-commons-apis-ext.jar
main class used: org.apache.fop.cli.Main
flags used: 
options used: 
arguments used: -c /etc/fop.xconf -version
FOP Version 2.8
   FORMATTER WRAPPER: /usr/share/daps/libexec/daps-fop
    FORMATTER CONFIG: /etc/daps/fop/fop-daps.xml

            MAKE_CMD: /usr/bin/remake -f /usr/share/daps/make/selector.mk --debug=b -j8 --always-make pdf 
       XSLTPROCESSOR: /usr/bin/xsltproc
   XML_CATALOG_FILES: /etc/xml/catalog

---------------

Reading makefiles...
Updating makefiles...
Updating goal targets...
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/MAIN-daps-stylesheet.xml' does not exist.
         File '/tmp/daps-xslt/build/.profiled/noprofile' does not exist.
        Must remake target '/tmp/daps-xslt/build/.profiled/noprofile'.
mkdir -p /tmp/daps-xslt/build/.profiled/noprofile
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
       File '/tmp/daps-xslt/build/.tmp' does not exist.
      Must remake target '/tmp/daps-xslt/build/.tmp'.
mkdir -p /tmp/daps-xslt/build/.tmp
    Must remake target '/tmp/daps-xslt/build/daps-stylesheet'.
mkdir -p /tmp/daps-xslt/build/daps-stylesheet
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
       File '/tmp/daps-xslt/build/.images/gen/' does not exist.
      Must remake target '/tmp/daps-xslt/build/.images/gen/'.
mkdir -p /tmp/daps-xslt/build/.images/gen/
       File '/tmp/daps-xslt/build/.images/color' does not exist.
      Must remake target '/tmp/daps-xslt/build/.images/color'.
mkdir -p /tmp/daps-xslt/build/.images/color
       File '/tmp/daps-xslt/build/.images/grayscale' does not exist.
      Must remake target '/tmp/daps-xslt/build/.images/grayscale'.
mkdir -p /tmp/daps-xslt/build/.images/grayscale
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
     File '/tmp/daps-xslt/build/.tmp/static' does not exist.
   File 'list-images-multisrc' does not exist.
  Must remake target 'list-images-multisrc'.
  Successfully remade target file 'list-images-multisrc'.
   File 'list-images-missing' does not exist.
  Must remake target 'list-images-missing'.
  Successfully remade target file 'list-images-missing'.
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/MAIN-daps-stylesheet.xml' does not exist.
      Must remake target '/tmp/daps-xslt/build/.profiled/noprofile/MAIN-daps-stylesheet.xml'.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
     File '/tmp/daps-xslt/build/.tmp/static' does not exist.
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
     File '/tmp/daps-xslt/build/.tmp/static' does not exist.
    Must remake target '/tmp/daps-xslt/build/.tmp/static'.
(cd /tmp/daps-xslt/build/.tmp && ln -sf /tmp/daps-xslt/xslt/static)
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
   Profiling /tmp/daps-xslt/xml/MAIN-daps-stylesheet.xml
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
/usr/share/daps/libexec/daps-xslt --output /tmp/daps-xslt/build/.profiled/noprofile/MAIN-daps-stylesheet.xml   \
  --stringparam "filename=MAIN-daps-stylesheet.xml" \
  --stylesheet /usr/share/daps/daps-xslt/profiling/noprofile5.xsl --file /tmp/daps-xslt/xml/MAIN-daps-stylesheet.xml /usr/bin/xsltproc
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
     File '/tmp/daps-xslt/build/.images/color/example1.png' does not exist.
    Must remake target '/tmp/daps-xslt/build/.images/color/example1.png'.
optipng -o0 -simulate /tmp/daps-xslt/images/src/png/example1.png 2>&1 | grep -q "already optimized"  || \
  ccecho "warn" " /tmp/daps-xslt/images/src/png/example1.png not optimized." >&2
     File '/tmp/daps-xslt/build/.images/color/example2.png' does not exist.
    Must remake target '/tmp/daps-xslt/build/.images/color/example2.png'.
optipng -o0 -simulate /tmp/daps-xslt/images/src/png/example2.png 2>&1 | grep -q "already optimized"  || \
  ccecho "warn" " /tmp/daps-xslt/images/src/png/example2.png not optimized." >&2
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
ln -sf /tmp/daps-xslt/images/src/png/example1.png /tmp/daps-xslt/build/.images/color/example1.png
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
 /tmp/daps-xslt/images/src/png/example2.png not optimized.
ln -sf /tmp/daps-xslt/images/src/png/example2.png /tmp/daps-xslt/build/.images/color/example2.png
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
       File '/tmp/daps-xslt/build/.profiled/noprofile/.validate' does not exist.
      Must remake target '/tmp/daps-xslt/build/.profiled/noprofile/.validate'.
   Validating...
   Successfully validated profiled sources.
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
     File '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo' does not exist.
    Must remake target '/tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo'.
   Creating fo-file...
/usr/share/daps/libexec/daps-xslt --xinclude --param "show.comments=0" --param "generate.permalink=0" --param "ulink.show=1" --stringparam "draft.mode=no" --stringparam "styleroot=/tmp/daps-xslt/xslt/" --param "format.print=0" --stringparam "img.src.path=/tmp/daps-xslt/build/.images/color/" --param "fop1.extensions=1" --param "xep.extensions=0"   \
      --stringparam "converter.name=DAPS" --stringparam "converter.version=4.0.beta1" --stringparam "converter.url=https://opensuse.github.io/daps" --stringparam admon.graphics.path=/tmp/daps-xslt/xslt/static/images/  \
     --output /tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo --stylesheet /tmp/daps-xslt/xslt/fo/docbook.xsl \
    --file /tmp/daps-xslt/build/.profiled/noprofile/MAIN-daps-stylesheet.xml /usr/bin/xsltproc  \
    ;
Making portrait pages on USletter paper (8.5inx11in)
Successfully created fo file /tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo
 File 'pdf' does not exist.
   File '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf' does not exist.
  Must remake target '/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf'.
   Creating PDF from fo-file...
(cd /tmp/daps-xslt/build/.tmp/ && /usr/share/daps/libexec/daps-fop /tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo /tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf  )
Java virtual machine used: /usr/lib64/jvm/java/bin/java
classpath used: /usr/share/java/xmlgraphics-fop.jar:/usr/share/java/xmlgraphics-fop-hyph.jar:/usr/share/java/xmlgraphics-commons.jar:/usr/share/java/commons-logging.jar:/usr/share/java/commons-io.jar:/usr/share/java/batik-all.jar:/usr/share/java/fontbox.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/xml-commons-apis-ext.jar:/usr/share/java/batik-all.jar:/usr/share/java/avalon-framework.jar
main class used: org.apache.fop.cli.Main
flags used: '-Djavax.xml.transform.URIResolver=org.apache.xml.resolver.tools.CatalogResolver' '-Djava.util.logging.config.file=/usr/share/daps/etc/fop/fop_logging.properties'
options used: '-Xms256m' '-Xmx2048m' '-Xss2048K'
arguments used: -c /etc/daps/fop/fop-daps.xml /tmp/daps-xslt/build/.tmp/daps-stylesheet-fop_en.fo /tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf
Not all fonts are embedded
 File 'pdf' does not exist.
Must remake target 'pdf'.
pdfinfo /tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf > /dev/null 2>&1 || ( ccecho "error" "PDF /tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf has a size of 0 bytes"; false )
PDF book built with REMARKS=0, DRAFT=no and META=0:
/tmp/daps-xslt/build/daps-stylesheet/daps-stylesheet_en.pdf

@kalimalrazif
Copy link
Author

Hi @tomschr!

What puzzles me is that when you just use the command line parameter --stringparam admon.graphics=1 it links the system images directory inside build/.tmp/static/images and build/ .tmp/images is done perfectly and the graphical admonitions are displayed.

But if you use your own style sheet it only links to build/.tmp/static/images from your xslt/fo/static/images directory but no link is made to build/.tmp/images neither from the system images directory nor from xslt/fo/static/images or the xslt/fo/images directory.

At the end of the day the directory used to render the images is build/.tmp/images not build/.tmp/static/images at least when using fo.

There's even a comment in the pdf.mk file that mentions some of this:

#Issue #419
# The upstream stylesheets set paths for admon, callout, and navig graphics
# to "images/" by default. However, DAPS' HTML builds require to set these
# paths to static/images/ regardless of what the stylesheets set
# To ensure the same path ("static/images/") can be used for HTML and PDF
# we need to create "static/images/" relative to the FO file
# This is done by the target $(TMP_STATIC_IMG_DIR): by setting a link to the
# stylesheet image or static directory
# In addition to that, we will also create a link $(TMP_DIR)/images to ensure
# building PDFs without explicitly setting a path for admon/callouts works
# as well.
#
# First, determine whether we have <STYLEROOT>/static or <STYLEROOT>/images
# (for a detailed explanation see html.mk)
#
# If we have a static directory, we can create a link to it in $(TMP_DIR)
# If we have an image directory, $(TMP_DIR)/static needs to be created and
# then a link to images in $(TMP_DIR)/static
#

Thanks in advance
Nomar

fsundermeyer added a commit that referenced this issue Nov 13, 2023
Previous implementation was simply wrong (and even caused make errors in some
cases)

Fixes #719
@fsundermeyer
Copy link
Member

Hi @kalimalrazif ,
thanks for reporting this issue. My previous implementation was actually buggy in many ways (and made little sense). I hope I was able to fix it with PR #720 (will require some more testing, but first results look good).

If you want to test:
Note that the PR is opened against the 4.0beta2 branch - if you have used a different branch, just download pdf.mk and replace yours with the download (should work for DAPS 4.0beta1).
Will do backports to 3.x once it is sufficiently tested.

@kalimalrazif
Copy link
Author

Thanks @fsundermeyer !!! :-) I will test it as soon as I can :-)

@kalimalrazif
Copy link
Author

Hi! I tried and the admonitions worked perfect :-) the thing now is the draft watermark :-( but I thing the same solution can apply to the watermarks.

This is the log output:

daps -vvvv -d ./DC-QPortal-Producto pdf --draft
---------------

        DAPS VERSION: 4.0.beta1

                BOOK: QPortal-Producto
                MAIN: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/MAIN-QPortal-Producto.xml
           BUILD_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build
            DAPSROOT: /usr/local/daps/share/daps
             DOCCONF: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/DC-QPortal-Producto
             PRJ_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs
             SRC_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml
         IMG_SRC_DIR: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs//home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/images/src


     DOCBOOK_VERSION: 5
        DOCBOOK5_RNG: /usr/share/xml/docbook/schema/rng/5.0/docbookxi.rng
        DBSTYLE_VERS: 1.79.1

           STYLEROOT: /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xslt
      STYLEROOT_VERS: Not available
  FALLBACK_STYLEROOT: /usr/share/xml/docbook/stylesheet/docbook-xsl-ns
   FB_STYLEROOT_VERS: Not available
            EPUB_CSS:
            HTML_CSS:

       PDF FORMATTER: fop
[warning] /usr/bin/fop: JVM flavor 'sun' not understood
   FORMATTER VERSION: FOP Version 2.4
   FORMATTER WRAPPER: /usr/local/daps/share/daps/libexec/daps-fop
    FORMATTER CONFIG: /etc/daps/fop/fop-daps.xml

            MAKE_CMD: /usr/bin/remake -f /usr/local/daps/share/daps/make/selector.mk --debug=b -j1 --always-make pdf
       XSLTPROCESSOR: /usr/bin/xsltproc
   XML_CATALOG_FILES: /etc/xml/catalog

---------------

Reading makefiles...
namespace warning : Namespace default prefix was not found
<emphasis>EmQu Advanced Services</emphasis>
         ^
namespace warning : Namespace default prefix was not found
<productname class='copyright'>&prod;</productname>
                              ^
namespace warning : Namespace default prefix was not found
<emphasis>EmQu AS</emphasis>
         ^
namespace warning : Namespace default prefix was not found
<orgname>EmQu Technologies</orgname>
        ^
/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter3.xml:3: warning: failed to load external entity "/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/entities-decl.ent.ent"
    %entities;
              ^
namespace warning : Namespace default prefix was not found
<orgname>EmQu Technologies</orgname>
        ^
Updating goal targets....
 File 'pdf' does not exist.
   File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf' does not exist.
     File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/QPortal-Producto-fop_es.fo' does not exist.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_appendix.xml' does not exist.
         File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile' does not exist.
        Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile'.
mkdir -p /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile
        Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile'.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_appendix.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_appendix.xml   \
  --stringparam "filename=HLD_appendix.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_appendix.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_appendix.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_book.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_book.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_book.xml   \
  --stringparam "filename=HLD_book.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_book.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_book.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter1.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter1.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter1.xml   \
  --stringparam "filename=HLD_chapter1.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter1.xml /usr/bin/xsltproc
namespace warning : Namespace default prefix was not found
<emphasis>EmQu Advanced Services</emphasis>
         ^
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter1.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter2.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter2.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter2.xml   \
  --stringparam "filename=HLD_chapter2.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter2.xml /usr/bin/xsltproc
namespace warning : Namespace default prefix was not found
<productname class='copyright'>&prod;</productname>
                              ^
namespace warning : Namespace default prefix was not found
<emphasis>EmQu AS</emphasis>
         ^
namespace warning : Namespace default prefix was not found
<orgname>EmQu Technologies</orgname>
        ^
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter2.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter3.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter3.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter3.xml   \
  --stringparam "filename=HLD_chapter3.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter3.xml /usr/bin/xsltproc
/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter3.xml:3: warning: failed to load external entity "/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/entities-decl.ent.ent"
    %entities;
              ^
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter3.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter4.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter4.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter4.xml   \
  --stringparam "filename=HLD_chapter4.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter4.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter4.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter5.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter5.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter5.xml   \
  --stringparam "filename=HLD_chapter5.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter5.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter5.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter6.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter6.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter6.xml   \
  --stringparam "filename=HLD_chapter6.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/HLD_chapter6.xml /usr/bin/xsltproc
namespace warning : Namespace default prefix was not found
<orgname>EmQu Technologies</orgname>
        ^
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/HLD_chapter6.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/MAIN-QPortal-Producto.xml' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/MAIN-QPortal-Producto.xml'.
/usr/local/daps/share/daps/libexec/daps-xslt --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/MAIN-QPortal-Producto.xml   \
  --stringparam "filename=MAIN-QPortal-Producto.xml" \
  --stylesheet /usr/local/daps/share/daps/daps-xslt/profiling/noprofile5.xsl --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xml/MAIN-QPortal-Producto.xml /usr/bin/xsltproc
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/MAIN-QPortal-Producto.xml'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/.validate' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/.validate'.
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/.validate'.
       File '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp' does not exist.
      Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp'.
mkdir -p /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp
      Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp'.
    Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/QPortal-Producto-fop_es.fo'.
/usr/local/daps/share/daps/libexec/daps-xslt --xinclude --param "show.comments=0" --param "generate.permalink=0" --param "ulink.show=1" --stringparam "draft.mode=yes" --stringparam "styleroot=" --param "format.print=0" --stringparam "img.src.path=/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.images/color/" --param "fop1.extensions=1" --param "xep.extensions=0" --stringparam "admon.graphics.path=/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xslt/fo/static/images/"   \
      --stringparam "converter.name=DAPS" --stringparam "converter.version=4.0.beta1" --stringparam "converter.url=https://opensuse.github.io/daps"   \
     --output /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/QPortal-Producto-fop_es.fo --stylesheet /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/xslt/fo/docbook.xsl \
    --file /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.profiled/noprofile/MAIN-QPortal-Producto.xml /usr/bin/xsltproc  \
    ;
Making portrait pages on USLetter paper (8.5inx11in)
    Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/QPortal-Producto-fop_es.fo'.
    Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto'.
mkdir -p /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto
    Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto'.
  Must remake target '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf'.
(cd /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/ && /usr/local/daps/share/daps/libexec/daps-fop /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/.tmp/QPortal-Producto-fop_es.fo /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf  )
[warning] /usr/bin/fop: JVM flavor 'sun' not understood
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:16320)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:17335)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:18348)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:19354)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:20359)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:21366)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:22366)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:23373)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:24382)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:25384)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:26390)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:27398)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:28399)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:29405)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:30413)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:31414)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:32421)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:33430)
[ERROR] FOUserAgent - Image not found. URI: images/draft.png. (See position 2:34432)
[WARN] FOUserAgent - Font "Dingbats,normal,700" not found. Substituting with "Dingbats,normal,400".
[WARN] FOUserAgent - Hyphenation pattern not found. URI: es.
[INFO] FOUserAgent - Rendered page #1.
[INFO] FOUserAgent - Rendered page #2.
[INFO] FOUserAgent - Rendered page #3.
[INFO] FOUserAgent - Rendered page #4.
[INFO] FOUserAgent - Rendered page #5.
[INFO] FOUserAgent - Rendered page #6.
[INFO] FOUserAgent - Rendered page #7.
[INFO] FOUserAgent - Rendered page #8.
[INFO] FOUserAgent - Rendered page #9.
[INFO] FOUserAgent - Rendered page #10.
[INFO] FOUserAgent - Rendered page #11.
[INFO] FOUserAgent - Rendered page #12.
[INFO] FOUserAgent - Rendered page #13.
  Successfully remade target file '/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf'.
   File 'list-images-multisrc' does not exist.
  Must remake target 'list-images-multisrc'.
  Successfully remade target file 'list-images-multisrc'.
   File 'list-images-missing' does not exist.
  Must remake target 'list-images-missing'.
  Successfully remade target file 'list-images-missing'.
Must remake target 'pdf'.
pdfinfo /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf > /dev/null 2>&1 || ( ccecho "error" "PDF /home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf has a size of 0 bytes"; false )
PDF book built with REMARKS=0, DRAFT=yes and META=0:
/home/nomar/Documents/Trabajos/EmQu/Documentos/Producto/QPortal-Producto-Docs/build/QPortal-Producto/QPortal-Producto_draft_es.pdf
Successfully remade target file 'pdf'.

Thanks in advance
Nomar

@kalimalrazif
Copy link
Author

Hi!

Looking at your solution I figure out a workaround by setting this on my DC file:
XSLTPARAM="--stringparam callout.graphics.path=${PWD}/xslt/fo/images/ --stringparam draft.watermark.image=${PWD}/xslt/fo/images/draft.png"

@tomschr
Copy link
Collaborator

tomschr commented Nov 16, 2023

Just a side note. Reading your log output, I found this warning:

namespace warning : Namespace default prefix was not found
<emphasis>EmQu Advanced Services</emphasis>

Do you use some entity file that you include in your other XML files? Does your entity definition contain DocBook tags?

If that is true, you are missing the DocBook 5 namespace. You should always add the xmlns into the first element like this:

<!ENTITY emqu   "<emphasis xmlns='http://docbook.org/ns/docbook'>EmQu Advanced Services</emphasis>">

@fsundermeyer
Copy link
Member

Hi,

Looking at your solution I figure out a workaround by setting this on my DC file:
XSLTPARAM="--stringparam callout.graphics.path=${PWD}/xslt/fo/images/ --stringparam
draft.watermark.image=${PWD}/xslt/fo/images/draft.png"

actually it is my believe that at least for FO the best is to put this into the styleheets - I think this is where it belongs. And if I am not mistaken, this should work out of the box without the need to provide parameters for DAPS (for FO!). @tomschr correct me if I am wrong.
If there is a need to overwrite the stylesheet defaults, the params would still work.

Unfortunately the story is different with HTML, since DAPS has to copy the images from the stylesheet directory into the resulting HTML directory structure to enable distributing and publishing the HTML.
That, is the reason why we introduced the static/ directory for our stylesheets. It has a defined directorty structure and holds everything, not only the images, but also CSS and JavaScript. DAPS just copies the whole static directory and sets paths according to the directory structure in static/.
This is something that is not clearly defined by the upstream stylesheets (BTW @tomschr , maybe you should suggest the static/ approach to upstream).

I could add the same "guessing logic" I use for HTML (for callouts and draft) in PDF as well.

Downside is that this is hardcoded and will overwrite settings provided via parameter (those arew silently ignored for HTML ATM).
The only way to avoid this is to introduce variables ADMON_IMG_PATH, CALLOUT_IMG_PATH, MISC-STYLE-IMG_PATH in the DC-file (if unset, assuming and testing for /Static or /images).

What do you think?

@tomschr
Copy link
Collaborator

tomschr commented Nov 16, 2023

actually it is my believe that at least for FO the best is to put this into the styleheets - I think this is where it belongs. And if I am not mistaken, this should work out of the box without the need to provide parameters for DAPS (for FO!). @tomschr correct me if I am wrong.
If there is a need to overwrite the stylesheet defaults, the params would still work.

I hope I got it right, but I fear this is not how XSLT works.

The problem is that XSLT 1.0 does not know how to convert a relative path into an absolute path. Although you can add an absolute path, such path won't help as it would only work for a specific user. Path manipulation was added in XSLT 2.0/3.0 which we don't use (yet).

You also cannot add something like $PWD in a stylesheet. That is shell, not XSLT. XSLT has no means to know the environment. To circumvent that issue, you have to set the parameters outside of the stylesheets and pass it through daps or the XSLT processor. This is what Normar did and it worked that way.

This can't be solved through XSLT 1.0 alone (so it wouldn't make sense to take it upstream).

I can imagine one way how it might work: DAPS could pass something like --stringparam styleroot $STYLEROOT whenever a DocBook stylesheet is called. A customization layer could define this parameter and concatenate $styleroot and the respective parameter (for example, callout.graphics.path) to get an absolute path.

I'm not sure if this is worth the effort. Adding the corresponding lines into the DC file is probably the more efficient solution.

@tomschr tomschr added topic-assembly Everything related to assembly processing and removed topic-assembly Everything related to assembly processing labels Nov 20, 2023
fsundermeyer added a commit that referenced this issue Jul 15, 2024
Previous implementation was simply wrong (and even caused make errors in some
cases)

Fixes #719
fsundermeyer added a commit that referenced this issue Jul 15, 2024
Simplified and fixed handling of admonition and callout graphics in PDFs.
The following locations for these graphics is supported:

STYLEIMG=

 1. <STYLEROOT>/fo/static/images
 2. <STYLEROOT>/fo/images
 3. <STYLEROOT>/static/images (suse-xsl-stylesheets)
 4. <STYLEROOT>/images (DocBook upstream)

First one (in the order above) wins if multiple of these locations exist.
It is assumed that the image directory layout follows DocBook upstream where
the admonition images reside directly under $STYLEIMG and the callouts under
$STYLEIMG/callouts/.

Note that in DocBook upstream admonitions are disabled by default and that low
resolution PNGs are used when acticvated. Consider using the following
parameters on the DAPS command line or use PARAM/STRINGPARAM in the DC-file to
override:

-param="admon.graphics=1"
--stringparam="admon.graphics.extension=.svg"
fsundermeyer added a commit that referenced this issue Aug 5, 2024
Simplified and fixed handling of admonition and callout graphics in PDFs.
The following locations for these graphics is supported:

STYLEIMG=

 1. <STYLEROOT>/fo/static/images
 2. <STYLEROOT>/fo/images
 3. <STYLEROOT>/static/images (suse-xsl-stylesheets)
 4. <STYLEROOT>/images (DocBook upstream)

First one (in the order above) wins if multiple of these locations exist.
It is assumed that the image directory layout follows DocBook upstream where
the admonition images reside directly under $STYLEIMG and the callouts under
$STYLEIMG/callouts/.

Note that in DocBook upstream admonitions are disabled by default and that low
resolution PNGs are used when acticvated. Consider using the following
parameters on the DAPS command line or use PARAM/STRINGPARAM in the DC-file to
override:

-param="admon.graphics=1"
--stringparam="admon.graphics.extension=.svg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants