Laurence Leff
Laurence Leff

Reputation: 76

docbook saxon toolchain does not recognize customization hard-page-break

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>

Upvotes: 0

Views: 105

Answers (1)

Laurence Leff
Laurence Leff

Reputation: 76

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.

Upvotes: 0

Related Questions