docbook / xslTNG

DocBook xslTNG Stylesheets
https://xsltng.docbook.org
MIT License
41 stars 20 forks source link

Initial implementation of partial support for copying media files #483

Closed fsteimke closed 3 months ago

fsteimke commented 4 months ago

This is an suggestion how to support user when they have to copy media files from the DocBook Sources to the HTML Result file structure. I think that support for this would be very helpfull, since the destination file structury may differ from the source file structure. This initial implementation covers only images (DocBook elements that lead to an html:img element) and does not include any documentation in the reference manual.

The idea is that every html:img element gets an additional attribute ghost:sourcefilename with the full path of the original media file in the docbook source file structure. This attribute is kept in all following transformations steps up to, and including, post processing.

The value of img/@src attribute is relative to the HTML file which includes the img element. When we know the $mediaobject-base-output-uri we can resolve the @src attribute against it to get an absolute value. The same should be possible with chunked output, but this is not implemented yet. When there are to absolute file-paths, we can generate copy-instructions, since we know source and destination.

If the function file:copy is available, the copy instructions can be executed. This is the case for users with a licence of SAXON-PE or EE including Users with Oxygen. Otherwise, a file with copy instructions could be generated (this is not implemented, since there is a conflict with the XSpec based test mechanism: Can't do result-document while evaluating as variable.).

In don't expect this PR to be merged into the Stylesheets, because it's incomplete. If you think the basic idea works, I would develop the proposal further.

Greetings, Frank

fsteimke commented 3 months ago

revoked