#1336 Error in processing images with absolute file URL

output: HTML

i am working with docbook 5 and stylesheets 1.78.1 bundled within the oxygen xml editor in windows 7. I have an docbooc book which is constructed as a result of some xslt transformation. Within this transformation, i use the unparsed-entity-uri() function to calculate the value of @fileref attributes for images. This xslt transformation is done with the saxon engine. The resulting book is valid with respect to docbook 5 RNG Grammar.
However, when i apply XHTML chunk Transformation, the images are not visible in the generated output.The links to the image file from HTML are broken. For example: @fileref='file:/C:/temp/image.png' in the docbook sources leads to @src='../../file:/C:/temp/image.png' within the img element in HTML.

I think the HTML transformation does not recognize it as an absolute file URI. I am pretty sure that this is caused by calculating the value of the @src attribute of the img element within the process.image template in the graphics.xsl file. If i understand correctly, it is checked whether the given URL contains the string '://'. If this is not the case, it is handled as a relative file URL. This is obviously the case in my example, since there is only one slash after the colon, not two. I tested the same thing after manually adding slashes (file:///C:/temp/image.png) ant everything works fine.

So it turns out that absolute file URIs in the form of 'file:/C:/ ...' are not supported properly. Since this is a valid syntax for absolute file URLs, and since this syntax is generated as a result of the unparsed-entity-uri() function, this seems to be a bug in the stylesheets.



  • Jirka Kosek

    Jirka Kosek - 2014-09-02

    The sad truth is that file URI is really underspecified and if you will strictly follow existing standards in the place you will find that file:/c:/... is not valid file URI. However such URIs are generated and consumed by many applications, so it seems reasonable to support this case in the stylesheets.

  • Robert Stayton

    Robert Stayton - 2014-09-06

    I checked in a fix for this to support that file:/ syntax for absolute paths in images. The latest snapshot was tested and works.

  • Robert Stayton

    Robert Stayton - 2014-09-06
    • status: open --> pending-fixed
    • assigned_to: Robert Stayton

Log in to post a comment.