Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support chunk for print media #484

Closed
fsteimke opened this issue Mar 7, 2024 · 1 comment
Closed

Support chunk for print media #484

fsteimke opened this issue Mar 7, 2024 · 1 comment

Comments

@fsteimke
Copy link
Contributor

fsteimke commented Mar 7, 2024

I admit that this seems to be a rather esoteric configuration, so let me first explain the general idea and use case:

  1. I'd like to support (at least partially) the copying of media files (see issue Feature request: a map with information necessary for copying media files #482 )
  2. I have made an initial implementation, which executes copy instructions when the function file:copy is available (which is the case, by the way, for users of Oxygen). See PR 483.
  3. Directly executable copy instructions are only possible, if both the source and the destination are known as absolute file paths. That means that i have to resolve every relative URI in ' img/@src` against the base-uri() of the HTML file.
  4. In case of a regular, non-chunked transformation i don't know the destination of the transformations primary result (the HTML file), so i don't know the base-uri for copy instructions.
  5. But chunked output can't be done without knowing the base-uri for HTML files, that's the rationale for $chunk-output-base-uri.
  6. So i am able to generate executable copy instructions only when doing chunked output.
  7. That is fine for online publishing, but what can i do if i am interested in PDF output?
  8. Solution: Doing "fake chunking" by setting the parameter $chunk-include to the empty list. I will get only one file at the file path that is the combination of $chunk-output-base-uri and $chunk. And i get executable copy instructions since the base-uri in known.

This works well when i use docbook.xsl for transformation. It does not, however, when i use print.xsl for paged media. The Error message is

Error at char 56 in expression in xsl:variable/@select on line 437 column 45 of chunk-cleanup.xsl:
  FORG0002  Base URI {} is not an absolute URI. Found while atomizing the value of parameter
  $adjusted-uri in {supplied} on line 647. Found while atomizing the value of variable
  $adjusted-uri in {xsl:apply-templates} on line 621

This error is independent of the value of the parameter $chunk-include, it also happens with the default value. I think the reason is that print.xsl has never been tested with the chunk mechanism.

I don't know how to use the XSpec based test mechanism for this special case, so i made a test case in the attached archive. The included shell script should explain how it is to be used.
testcase.zip

Greetings, Frank

@fsteimke fsteimke changed the title Fake chunk generation for paged media fails when source file contains mediaobjects Support chunk for print media Mar 10, 2024
@fsteimke
Copy link
Contributor Author

The whole idea of chunk support for print media is based on the conviction, that there is no other way to find out the base uri of the primary output document than to use the $chunk-output-base-uri parameter. I never wanted print files to be chunked. I just wanted the current outpu URI.

Today i have learned that there is a fn:current-output-uri standard function in XSLT 3. Sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant