« Return to Thread: Howto customize title for legalnotice

Re: Howto customize title for legalnotice

by spr :: Rate this Message:

Reply to Author | View in Thread

Did not work either even with Saxon :(

I have attached the generated PDF.
See the green color on "Important Notice".
Used the "green" to ensure that customization is being processed.

~spr

My input XML is:
<?xml version='1.0'?>
<!DOCTYPE book PUBLIC
    "-//OASIS//DTD DocBook V5.0//EN"
    "file:///D:/wrk/BookTest/docbook-5.0CR5/dtd/docbook.dtd" [
<!ENTITY nbsp               " ">
]>

<book
  lang        = "en"
  xmlns       = "http://docbook.org/ns/docbook" version="5.0"test.pdf
  xmlns:xi    = "http://www.w3.org/2001/XInclude"
  xmlns:xsl   = "http://www.w3.org/1999/XSL/Transform"
  xmlns:xlink = "http://www.w3.org/1999/xlink">

  <info>
    <title>Book Title</title>
    <releaseinfo>Release Info</releaseinfo>

    <legalnotice>
      <title>IMPORTANT NOTICE</title>
      <para>
      This is a copyright text.
      </para>
    </legalnotice>
     
  </info>

  <chapter id="test">
    <info>
      <title>Test Chapter</title>
    </info>
    <para>
    simple test para
    </para>
  </chapter>
</book>

My minimal customization is:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    xmlns:xsl   = "http://www.w3.org/1999/XSL/Transform"
    xmlns:fo    = "http://www.w3.org/1999/XSL/Format"
    xmlns:d     = "http://docbook.org/ns/docbook"
    version     = "5.0"
    xmlns:l     = "http://docbook.sourceforge.net/xmlns/l10n/1.0">

  <xsl:import
    href    = "../docbook-xsl-ns-1.73.2/fo/docbook.xsl" />

  <xsl:attribute-set name="formal.title.properties">
  <xsl:attribute name="color">
    <xsl:choose>
      <xsl:when test = "self::legalnotice">red</xsl:when>
      <xsl:otherwise>green</xsl:otherwise>
    </xsl:choose>
  </xsl:attribute>
  </xsl:attribute-set>

</xsl:stylesheet>

My execution log is:
D:\wrk\BookTest>xform-saxon.cmd CLASSPATH=D:\bin\JavaClasses\saxon6-5-5\saxon.jar;D:\bin\JavaClasses\saxon6-5-5\saxon-jdom.jar;D:\bin\JavaClasses\saxon6-5-5\saxon-xml-apis.jar;.\docbook-xsl-ns-1.73.2\extensions\saxon65.jar
java com.icl.saxon.StyleSheet -o .\output\test\test.fo .\input\test\index.xml .\custom\tst-pdf.xsl use.extensions=1
Making portrait pages on USletter paper (8.5inx11in)
.\fop-0.94\fop.bat -fo .\output\test\test.fo -pdf .\output\test\test.pdf
Oct 8, 2007 2:13:42 AM org.apache.fop.hyphenation.Hyphenator getHyphenationTree
SEVERE: Couldn't find hyphenation pattern en

D:\wrk\BookTest>

The extract from generated .fo is:
<fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em" font-weight="bold" font-size="12pt" hyphenate="false" space-after.minimum="0.4em" space-after.optimum="0.6em" space-after.maximum="0.8em" color="green" keep-with-next.within-column="always">IMPORTANT NOTICE</fo:block><fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">
      This is a copyright text.
      </fo:block>


I have only 20 lines of text in the test document.
Still haven't setup my PC for using xsltproc/saxon will do it tomorrow and get back...

~spr
Bob Stayton wrote:
Hmm, I cut and pasted your attribute-set into a simple customization layer
based on 1.73.2 fo/docbook.xsl, processed a short book with xsltproc and
fop 0.94, and it worked.  I also processed it with the fop shell script,
and that worked as well.  That is, the legalnotice title was rendered in
red on the verso titlepage, while other formal titles appeared in black.

Have you tried it with a minimal customization layer to see if something
else is affecting it?

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net

~spr

 « Return to Thread: Howto customize title for legalnotice