Include local Graphic in Docbook -> Pdf

Here should go questions about transforming XML with XSLT and FOP.
Chris89
Posts: 3

Include local Graphic in Docbook -> Pdf

Wed Dec 20, 2017 3:36 pm

Hello everyone,

im currently trying to customize a docbook footer and for that i need to include an image in that footer.
Sadly the including of an image is not yet working. I have the PNG file test.png that is located at N:\test.png for simplicity.

I tryed to include it like this

Code: Select all

<fo:external-graphic content-height="1.2cm">
          <xsl:attribute name="src">
            <xsl:call-template name="fo-external-image">
              <xsl:with-param name="filname" select="N:/test.png'"/>
            </xsl:call-template>
          </xsl:attribute>
        </fo:external-graphic>


However the line

Code: Select all

<xsl:with-param name="filname" select="'N:\test.png'"/>

seems not to work.

My questin is: How do i have to specify the local path (absolut) so that my image gets included in the final pdf output.
Radu
Posts: 5763

Re: Include local Graphic in Docbook -> Pdf

Wed Dec 20, 2017 3:44 pm

Hi,

Ideally as this question is Docbook related you could consider registering on the Docbook-Apps mailing list and asking it there:

http://docbook.org/help

We do not work much with Docbook internally and the Docbook users list contains lots of experienced Docbook users.
I'm not sure in what context your XSLT code gets called, maybe you can add a variable definition around the call-template and then use an xsl:message to list the variable's value and see if the source for the image is properly computed.
I would also suggest sending the image reference as an URL like file:/N:/test.png instead of N:/test.png.
If you have defined the "Docbook PDF" transformation scenario in Oxygen you can also press the "Debug Transformation Scenario" toolbar button to switch to the XSLT Debugger perspective, run the transformation there and see what the generated XSL-FO file looks like.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 5763

Re: Include local Graphic in Docbook -> Pdf

Thu Dec 21, 2017 9:44 am

Linking to the discussion Christian started on the Docbook Users List for future reference:

https://lists.oasis-open.org/archives/docbook-apps/201712/msg00012.html

So the correct solution was that absolute references to images in the XSL-FO were to have three slashes, like "file:///c:/test.png" in order for the processor to properly interpret them.
Sorry for not testing my previous solution with using a single slash for the URL, Oxygen knows both these formats but the FO processor seems to be limited at interpreting only one kind of file URL.
Two more things:

- In the Oxygen Preferences->"XML / XSLT-FO-XQuery / FO Processors" you can choose to enable the output of the built-in FO processor. This will show you possible warnings when such problems are encountered.
- Ideally you should avoid absolute references completely as they make the XSLT processing not portable, somebody else would need to copy the image in precisely the same place as you do in order to make this work. So ideally you would have a reference in the XSL-FO file relative to where it is placed on disk.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “XSLT and FOP”

Who is online

Users browsing this forum: david-gopois69 and 1 guest