i have an docbook document with an image defined as an entity:
Code: Select all
<!DOCTYPE article [
<!ENTITY img SYSTEM "image.png" NDATA PNG>
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<para>Contains a <mediaobject><imageobject><imagedata entityref="img"/></imageobject></mediaobject></para>
Using the docbook xsl 1.78.1 that comes bundled with the oxygen version 16.0 i try to transform this to xhtml. However, the image is not visible. The problem is:
- The stylesheet uses the unparsed-entity-uri() function. It's value is "file:/C:/temp/image.png" when using the saxon engine.
- the process.image template in graphics.xsl has to generate the @src attribute in the html:img element.
- it tries to determine if the given filename is an absolute filename. If so, it leaves it untouched.
- The important condition is "not(contains($output_filename, '://'))". This, however, does not match with the result of the unparsed-entity-uri() function, because there is only one slash after the colon, not two.
Obviously, there is a mismatch. Question is, whether this is a correct URL for an absolute filename.
If it is not, then there is a problem with the unparsed-entity-uri() function, since it should never return an invalid URL.
If it is, then there is a problem with the process.image template, since it should be able to process URLs with absolute filenames.
I asked this question on the docbook-apps mailing list, and got an funny answer: It depends on your definition of correctness. Hmmm. So i had a look in wikipedia for file urls and found the general schema:
Code: Select all
host can be omitted, resulting in three slashes. But, still, unparsed-entity-uri() gives only one ...
The advice how to deal with the situation was: avoid absolute filenames and feel free to post a bug report.
Frankly, i'm lost. Is this a bug? If so, who is wrong? Is the implementation of unparsed-entity-uri() in saxon incorrect, or is there a bug in the stylesheets since they can't handle correct URLs?
And, last but not least, do you have a better advice than just avoid absolute filenames?