Initial implementation of partial support for copying media files #483
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 attributeghost: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 theimg
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 doresult-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