0

I cannot get docbook tool chain to do the hard page break as described at the end of http://www.sagehill.net/docbookxsl/PageBreaking.html (I used to have this working for me but seem to have lost the mojo.)

Here is the script to invoke docbook and saxon

#!/bin/sh

export CLASSPATH=/home/leffstudent/saxon-6.0.1.jar:/home/leffstudent/docbook-sl-1.79.1/saxon65.jar 
echo $CLASSPATH
java com.icl.saxon.StyleSheet \
   -o $1.fo  $1 stO.xsl  \
   use.extensions=1 default.table.width=auto title.margin.left=0pc insert.xref.page.number=yes 

(stO.xsl also sets my ref parameters on how xref should display page numbers. That is not working, either. Thus, I suspect that my invocation of com.icl.saxon.Stylesheet is ignoring my customization link


Here is the test docbook file I tried. (The real files is a 500 page class notes.)

<section><title> </title>
<para>
abc
</para>
<?hard-pagebreak?>
<para>
def
</para>
</section>

Here is the style sheet, stO.xsl

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:import href="./titlepage.xsl"/>
<xsl:import href="/home/leffstudent/docbook-xsl-1.79.1/fo/docbook.xsl"/>
<xsl:template match="processing-instruction('hard-pagebreak')">
  <fo:block break-after='page'/>
</xsl:template>
<xsl:attribute-set name="formal.object.properties">
  <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
</xsl:attribute-set>
<xsl:param name="local.l10n.xml" select="document('')"/>
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
<l:l10n language="en">
<l:context name="xref">
<l:template name="section" text="%t on Page Number %p"/>
  <l:template name="mediaobject" text="%t on Page Number %p"/> 
  <l:template name="imageobject" text="%p"/>
</l:context>
<l:context name="xref-number-and-title">
  <l:template name="section" text="%t on Page Number %p"/>
  <l:template name="imageobject" text="%p"/>
</l:context>
</l:l10n>
</l:i18n>
</xsl:stylesheet>
mzjn
  • 48,958
  • 13
  • 128
  • 248
Laurence Leff
  • 76
  • 1
  • 8
  • Does your approach work with another XSLT processor? What is the FO output you get with Saxon, how does your wanted FO output look or the one of another processor? And which version of DocBook is that? – Martin Honnen Apr 30 '19 at 08:05
  • My FO output is 29517 bytes over four lines. It did not seem appropriate to post it. When I run it through RenderX, there was no page breaks. I used to get page breaks with this approach. @honnen – Laurence Leff Apr 30 '19 at 14:49
  • As indicated in the shell file, I am using docbook 1.79 – Laurence Leff Apr 30 '19 at 14:50
  • Isn't that the version number of the stylesheets? I thought the DocBook versions in use today are the current version 5 or the older version 4. – Martin Honnen Apr 30 '19 at 14:55
  • 2LaurenceLeff There is a difference between DocBook version (that can be 4.5, 5.0, 5.1 - whatever) and DocBook XSL Stylesheets version that can be 1.XX (i.e 1.79.1). Martin Honnen asked you about DocBook version (i.e. version of the source files) - not the XSL version. – Eduard Tibet May 01 '19 at 11:02
  • I tried Xalan. I am having a different problem with that. That is Question 55941299 I do not know what docbook version I am using. How do I find out? – Laurence Leff May 01 '19 at 19:07
  • Open your source file (source (!) - not a processing stylesheets) and look at the header (heading 2-3 lines). If it contains something like xmlns="http://docbook.org/ns/docbook" - it is 5.0/5/1 for sure, if something like – Eduard Tibet May 03 '19 at 05:50
  • I have neither for this test--as shown above. Sometimes I use something like: The latter says "docbook ...V 4.5" – Laurence Leff May 03 '19 at 18:08
  • I also tried this with xsltproc. I have the same problem with hard page break showing up there...Related Question 55941299 – Laurence Leff May 04 '19 at 20:15

1 Answers1

0

I got this working finally with XSLTPROC:

#!/bin/sh

xsltproc --output $1.fo sd.xsl $1

It prints a separate page where I have the hard-pagebreak processing instruction.


Here is the customization layer, sd.xsl

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:import href="/home/leffstudent/docbook-xsl-1.79.1/fo/docbook.xsl"/>
<xsl:template match="processing-instruction('hard-pagebreak')">
  <fo:block break-after='page'/>
</xsl:template>
</xsl:stylesheet>

I have tried again getting my xref's to work with pictures. (That, of course, is with a larger file than sd.xsl But that is a separate issue, both literally and figuratively.)

I still have not been able to get this working with Xalan. See Question 55941299.

I have to check again to see if I can get this to work with saxon. This is is what I used to use to prepare my class notes. However, I can prepare out my 530-page class notes with xsltproc with proper page breaks.

Laurence Leff
  • 76
  • 1
  • 8