Re: Customizing the DITA -> EPUB3 conversion [WAS: Copyright page title and page number reference]

Hussein Shafie <[email protected]> Wed, 16 Oct 2024 10:26:34 +0200
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
Z. wrote:
> 
> Thanks for getting back to me! I appreciate that.
> 
> I tried with the following changes to my zhihui-pdf.xsl file, it worked:
> 
> +  <xsl:param name="page-ref-before"> on page </xsl:param>
> +
> +  <xsl:param name="show-link-page">yes</xsl:param>
> +
> +  <xsl:param name="show-xref-page">yes</xsl:param>
> 
> However, it adds " on page xxx" to *all* figure references. 

Yes.

> Is it possible to do this only when needed? like when a figure and its 
> reference are not on the same page. That would be great.

No, not to may knowledge.



> 
> I also tried this to generate an EPUB3 file. It does not have any effect 
> there. That is fine.

That's normal. Unlike PDF, RTF, DOCX, ODT, EPUB3 is not an XSL-FO based 
format thus, the above XSLT stylesheet parameters show-link-page, 
show-xref-page, etc, are not supported.

Only  link-auto-text, xref-auto-text are supported.

See 
https://www.xmlmind.com/ditac/_distrib/doc/manual/webhelp/xsltParams.html



> 
> However, in doing so, I found out that my EPUB3 file is not formatted at 
> all.
> 
> Right now, my customization consists of the following three parts:
> 
> (1) zhihui-pdf.xsl, which contains things like
> 
>      <xsl:attribute-set name="link-style">
>      <xsl:attribute name="color">#000000</xsl:attribute>
>      </xsl:attribute-set>
>      <xsl:attribute-set name="varname">
>      <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
>      </xsl:attribute-set>
> 
> (2) dita.toPS.transformParameters.xml, which contains margin and footer 
> settings, font size and justification.
> 
> (3) I also made some very small changes in a few files.
>       For example, in addon/config/dita/xsl/fo/software.xsl, I added:
> 
>        <xsl:attribute-set name="cmdname">
>        <xsl:attribute name="font-size">1.1em</xsl:attribute>
>        <xsl:attribute name="font-style">italic</xsl:attribute>
>         </xsl:attribute-set>
> 
> How do I use similar formatting to generate an EPUB3 file? Is there any 
> configuration file or some .xsl files I can edit
> (or maybe EPUB3 does not use xsl files at all)?
> 

EPUB3 not being an XSL-FO based format, the output cannot be customized 
using xsl:attribute-set. You must customize the CSS stylesheet used to 
style the generated EPUB3 (which is embedded in the EPUB3 file).

These concept are explained here: 
https://www.xmlmind.com/xmleditor/_distrib/doc/help/ConversionStylesheetsEditor_intro.html

How to customize the CSS stylesheet used to style the generated EPUB3 is 
explained here: 
https://www.xmlmind.com/xmleditor/_distrib/doc/help/ConversionStylesheetsEditor_reference.html

(In a nutshell:
0) Open or create a DITA map.
1) Options|Customize Configuration|Customize Document Conversion Stylesheets
2) Select "PUB"
3) Click "Customize" to create the CSS customization file. See attached 
Customize_CSS_1.png
4) Click "Edit" to populate this file with CSS styles. See attached 
Customize_CSS_2.png)

In order to learn about the class names used by the XHTML pages 
comprising the EPUB3, please take a look at attached CSS file.
The other way to learn about these class names is to look, inside the 
EPUB file (which is a ZIP file), to the XHTML pages comprising the EPUB.

This attached CSS file is just a copy of 
XXE_install_dir/addon/config/dita/xsl/resources/base.css

These class names *may* be needed in order to create some of the CSS 
selectors of your customization.
Customize_CSS_1.png (image/png, 429.9 KB) - not displayed
Customize_CSS_2.png (image/png, 312.1 KB) - not displayed