List Info

Thread: Customize header content, problem with 1.73.1




Customize header content, problem with 1.73.1
user name
2007-08-23 09:18:06
I have a customization layer which sets header content to book title centered on even, chapter title on odd pages.  This works fine with the Docbook 4.5 DTD and the 1.73.1 snapshot stylesheet, but with db 5.0 the book title on even pages is missing.   This must be a namespace problem, but I can't see it.

Any help appreciated.  My customization is below.

Ron

4.5 DTD version
<?xml version=&quot;1.0"; encoding=&quot;UTF-8&quot; ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
<book id="SSF&quot; lang="EN&quot; >
<title&gt;A Title for the 4.5 version</title>
<chapter> <para>.....</para><para>....&lt;/para></chapter>
<chapter> <para>.....</para><para>....&lt;/para></chapter>
</book&gt;

5.0 version
<?xml version=&quot;1.0"; encoding=&quot;UTF-8&quot; ?>
<!DOCTYPE book>;
<book  xml:id="SSF&quot; xmlns="http://docbook.org/ns/docbook" version="5.0&quot; xml:lang="EN&quot;>
<info&gt;
<title&gt;A Title for the 5.0 version</title>
</info&gt;
<chapter> <para>.....</para><para>....&lt;/para></chapter>
<chapter> <para>.....</para><para>....&lt;/para></chapter>
</book&gt;

CUSTOMIZATION LAYER FOR 5.0

<?xml version=&quot;1.0"; encoding=&quot;UTF-8&quot;?>
<xsl:stylesheet
  xmlns:d="http://docbook.org/ns/docbook"
  xmlnssl
="http://www.w3.org/1999/XSL/Transform&quot;
  xmlns:fo
="http://www.w3.org/1999/XSL/Format&quot;
  xmlns:exsl
="http://exslt.org/common&quot;
  exclude-result-prefixes
="exsl"
  version
="1.0&quot;>

<!-- import 1.71.1 stylesheet -->
<!-- &lt;xsl:import href=&quot;/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/xsl/fo/docbook.xsl&quot; /> -->
<!-- import the 1.73.1 snapshot&nbsp; name space aware stylesheet  --&gt;
<xsl:import href="/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.73.1/fo/docbook.xsl" />
<!-- import the 1.73.1 snapshot&nbsp; stylesheet  -->
<!-- &lt;xsl:import href=&quot;/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-1.73.1/fo/docbook.xsl" /> --&gt;

<!-- ============================================================================================== -->
<!-- select single- ("0&quot;) or double-sided ("1&quot;) output -->
<xsl:param name="double.sided&quot; select="1&quot; />

<!-- Customize the header content, book title centered on even, chapter title on odd pages ; -->
<!-- ============================================================================================== -->
<!-- set relative space in header for left, center and right cells ; -->
<xsl:param name="header.column.widths" select="'1 10 1'&quot; >
</xsl:param>

<!-- ============================================================================================== -->
<!-- rule below header&nbsp; -->
<xsl:param name="header.rule&quot; select="1&quot; >
</xsl:param>

<!-- define the rule below the header -->
<xsl:template name="head.sep.rule&quot;>
 
<xsl:if test="$header.rule != 0">
 &nbsp;  <xsl:attribute name="border-bottom-width">0.5pt</xsl:attribute>;
 &nbsp;  <xsl:attribute name="border-bottom-style">solid</xsl:attribute>;
 &nbsp; 
<xsl:attribute name="border-bottom-color">black</xsl:attribute>;
 
</xsl:if>
</xsl:template>

<!-- ============================================================================================== -->
<!-- set header content style ; -->
<xsl:attribute-set name="header.content.properties&quot;>
 
<xsl:attribute name="font-family&quot;>Cardo</xsl:attribute>;
 
<xsl:attribute name="font-size">11pt</xsl:attribute>;
 
<xsl:attribute name="font-weight&quot;>bold</xsl:attribute>;
</xsl:attribute-set>

<!-- ============================================================================================== -->
<!-- Customize the header content, book title centered on even, chapter title on odd pages ; -->
<xsl:template name="header.content&quot;> 

 
<xsl:param name="pageclass" select="''&quot;/>
 
<xsl:param name="sequence" select="''&quot;/>
 
<xsl:param name="position" select="''&quot;/>
 
<xsl:param name="gentext-key&quot; select="''&quot;/>

&nbsp;
<xsl:variable name="candidate">
 &nbsp; 
<!-- sequence can be odd, even, first, blank --&gt;
 &nbsp; 
<!-- position can be left, center, right --&gt;
 &nbsp; 
<xsl:choose>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'odd' and $position = 'left'&quot;>
 &nbsp; &nbsp; &nbsp;  <fo:retrieve-marker retrieve-class-name="section.head.marker"
 &nbsp;   ; &nbsp; &nbsp; &nbsp; ; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; retrieve-position
="first-including-carryover&quot;
 &nbsp;   ; &nbsp; &nbsp; &nbsp; ; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; retrieve-boundary
="page-sequence&quot;/>
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'odd' and $position = 'center'">
 &nbsp;   ; &nbsp;
<xsl:apply-templates select=".&quot; mode="titleabbrev.markup"/>
 &nbsp;   ; &nbsp;
<xsl:call-template name="draft.text";/>
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'odd' and $position = 'right'">
 &nbsp;   ; &nbsp;
<xsl:call-template name="draft.text";/>
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'even' and $position = 'left'&quot;> 
&nbsp;   ; &nbsp; 
<xsl:call-template name="draft.text";/>
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'even' and $position = 'center'">
 &nbsp;   ; &nbsp;
<xsl:value-of  select="ancestor-or-self::d:book/d:info/d:title"/>
<!-- 4.5 version &nbsp; <xsl:value-of ; select=&quot;ancestor-or-self::book/title"/>  ; &nbsp; **********  -->
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'even' and $position = 'right'">
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'first' and $position = 'left'&quot;>
 &nbsp;   ;
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'first' and $position = 'right'"> 
&nbsp;   
</xsl:when>

&nbsp; &nbsp; &nbsp;
<xsl:when test="$sequence = 'first' and $position = 'center'">
 &nbsp;   ; &nbsp;
<xsl:value-of
 &nbsp;   ; &nbsp; &nbsp; &nbsp; ; &nbsp; select
="ancestor-or-self::d:book/d:info/d:orgname"/>
<!-- 4.5 version &nbsp; select="ancestor-or-self::book/info/corpauthor"/>&nbsp; &nbsp; ********** -->
&nbsp;   ;  </xsl:when>

 &nbsp; &nbsp;  <xsl:when test=";$sequence = 'blank' and $position = 'left'&quot;>
&nbsp; &nbsp;   </xsl:when>

 &nbsp; &nbsp;  <xsl:when test=";$sequence = 'blank' and $position = 'center'&quot;>
  ; &nbsp; &nbsp;  <xsl:text>This page intentionally left blank</xsl:text>;
 &nbsp;   ; </xsl:when>

 &nbsp; &nbsp;  <xsl:when test=";$sequence = 'blank' and $position = 'right'&quot;>
&nbsp;   ;  </xsl:when>

 &nbsp;  </xsl:choose>
  </xsl:variable>

 ; &nbsp; <!-- Does runtime parameter turn off blank page headers? -->

 &nbsp; 
<xsl:choose>
 &nbsp;   ;
<xsl:when test="$sequence='blank' and $headers.on.blank.pages=0&quot;>
 &nbsp;   ; &nbsp;
<!-- no output -->
 &nbsp;   ;
</xsl:when>
 &nbsp; 
<!-- titlepages have no headers -->
 &nbsp;   ;
<xsl:when test="$pageclass = 'titlepage'"> 
&nbsp;   ; &nbsp; 
<!-- no output -->
 &nbsp;   ;
</xsl:when>
 &nbsp;   ;
<xsl:otherwise>
 &nbsp;   ; &nbsp;
<xsl:copy-of select="$candidate";/>
 &nbsp;   ;
</xsl:otherwise>;
 &nbsp; 
</xsl:choose>

</xsl:template>

</xsl:stylesheet >
-- 
Ron Catterall, Phd, DSc &nbsp; &nbsp;     ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;  email: roncatterall.net
Prolongacion de Hidalgo 140     ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp; http://catterall.net/
San Felipe del Agua ; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp;   ; tel: +52 951 520 1821
Oaxaca &nbsp; &nbsp;  68020&nbsp; Mexico    ; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;   &nbsp;   ; &nbsp; fax: +1 530 348 8309
Re: Customize header content, problem with 1.73.1
user name
2007-08-27 22:38:46
I tried your customization outside of Oxygen and it worked for me.  Have you tried it outside of Oxygen?
 
Bob Stayton
Sagehill Enterprises
DocBook Consulting
sagehill.net">bobssagehill.net
&nbsp;
 ;
----- Original Message -----
Sent: Thursday, August 23, 2007 7:18 AM
Subject: [docbook-apps] Customize header content, problem with 1.73.1

I have a customization layer which sets header content to book title centered on even, chapter title on odd pages.&nbsp; This works fine with the Docbook 4.5 DTD and the 1.73.1 snapshot stylesheet, but with db 5.0 the book title on even pages is missing. &nbsp; This must be a namespace problem, but I can't see it.

Any help appreciated.  My customization is below.

Ron

4.5 DTD version
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<book id="SSF" lang="EN" >
<title&gt;A Title for the 4.5 version</title>
<chapter> <para&gt;.....</para>&lt;para>....</para></chapter>;
<chapter> <para&gt;.....</para>&lt;para>....</para></chapter>;
</book&gt;

5.0 version
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE book>
<book  xml:id="SSF" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="EN">
<info&gt;
<title&gt;A Title for the 5.0 version</title>
</info&gt;
<chapter> <para&gt;.....</para>&lt;para>....</para></chapter>;
<chapter> <para&gt;.....</para>&lt;para>....</para></chapter>;
</book&gt;

CUSTOMIZATION LAYER FOR 5.0

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
  xmlns:d="http://docbook.org/ns/docbook"
  xmlnssl
="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo
="http://www.w3.org/1999/XSL/Format"
  xmlns:exsl
="http://exslt.org/common"
  exclude-result-prefixes
="exsl"
  version
="1.0">

<!-- import 1.71.1 stylesheet -->
<!-- <xsl:import href="/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/xsl/fo/docbook.xsl" /> -->
<!-- import the 1.73.1 snapshot&nbsp; name space aware stylesheet  -->
<xsl:import href="/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.73.1/fo/docbook.xsl" />
<!-- import the 1.73.1 snapshot&nbsp; stylesheet  -->
<!-- <xsl:import href="/Applications/Utilities/oxygen/8.2/oxygen/frameworks/docbook/5.0/docbook-xsl-1.73.1/fo/docbook.xsl" /> -->

<!-- ============================================================================================== -->
<!-- select single- ("0") or double-sided ("1") output -->
<xsl:param name="double.sided" select="1" />

<!-- Customize the header content, book title centered on even, chapter title on odd pages ; -->
<!-- ============================================================================================== -->
<!-- set relative space in header for left, center and right cells ; -->
<xsl:param name="header.column.widths" select="'1 10 1'" >
</xsl:param>

<!-- ============================================================================================== -->
<!-- rule below header&nbsp; -->
<xsl:param name="header.rule" select="1" >
</xsl:param>

<!-- define the rule below the header -->
<xsl:template name="head.sep.rule">
 
<xsl:if test="$header.rule != 0">
 &nbsp;  <xsl:attribute name="border-bottom-width">0.5pt</xsl:attribute>;
 &nbsp;  <xsl:attribute name="border-bottom-style">solid</xsl:attribute>;
 &nbsp; 
<xsl:attribute name="border-bottom-color">black</xsl:attribute>;
 
</xsl:if>
</xsl:template>

<!-- ============================================================================================== -->
<!-- set header content style ; -->
<xsl:attribute-set name="header.content.properties">
 
<xsl:attribute name="font-family">Cardo</xsl:attribute>;
 
<xsl:attribute name="font-size">11pt</xsl:attribute>;
 
<xsl:attribute name="font-weight">bold</xsl:attribute>;
</xsl:attribute-set>

<!-- ============================================================================================== -->
<!-- Customize the header content, book title centered on even, chapter title on odd pages ; -->
<xsl:template name="header.content"> 

&nbsp;
<xsl:param name="pageclass" select="''"/>
 
<xsl:param name="sequence" select="''"/>
 
<xsl:param name="position" select="''"/>
 
<xsl:param name="gentext-key" select="''"/>

 
<xsl:variable name="candidate">
 &nbsp; 
<!-- sequence can be odd, even, first, blank -->
 &nbsp; 
<!-- position can be left, center, right -->
 &nbsp; 
<xsl:choose>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'odd' and $position = 'left'">
 &nbsp; &nbsp; &nbsp;  <fo:retrieve-marker retrieve-class-name="section.head.marker"
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; ; &nbsp; &nbsp; retrieve-position
="first-including-carryover"
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; ; &nbsp; &nbsp; retrieve-boundary
="page-sequence"/>
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'odd' and $position = 'center'">
 &nbsp; &nbsp; &nbsp; 
<xsl:apply-templates select="." mode="titleabbrev.markup"/>
 &nbsp; &nbsp; &nbsp; 
<xsl:call-template name="draft.text"/>
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'odd' and $position = 'right'">
 &nbsp; &nbsp; &nbsp; 
<xsl:call-template name="draft.text"/>
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'even' and $position = 'left'"> 
&nbsp; &nbsp; &nbsp;  
<xsl:call-template name="draft.text"/>
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'even' and $position = 'center'">
 &nbsp; &nbsp; &nbsp; 
<xsl:value-of  select="ancestor-or-self::d:book/d:info/d:title"/>
<!-- 4.5 version&nbsp;  <xsl:value-of ; select="ancestor-or-self::book/title"/>&nbsp;  &nbsp; **********  -->
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'even' and $position = 'right'">
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'first' and $position = 'left'">
 &nbsp; &nbsp; 
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'first' and $position = 'right'"> 
&nbsp; &nbsp; &nbsp;
</xsl:when>

 &nbsp; &nbsp; 
<xsl:when test="$sequence = 'first' and $position = 'center'">
 &nbsp; &nbsp; &nbsp; 
<xsl:value-of
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  select
="ancestor-or-self::d:book/d:info/d:orgname"/>
<!-- 4.5 version&nbsp;  select="ancestor-or-self::book/info/corpauthor"/>&nbsp; ; &nbsp; ********** -->
&nbsp; &nbsp; &nbsp; </xsl:when>

&nbsp; &nbsp;   <xsl:when test="$sequence = 'blank' and $position = 'left'">;
 &nbsp; &nbsp;  </xsl:when>

&nbsp; &nbsp;   <xsl:when test="$sequence = 'blank' and $position = 'center'"&gt;
 &nbsp;   ; &nbsp; <xsl:text>This page intentionally left blank</xsl:text>;
 &nbsp; &nbsp;  </xsl:when>

&nbsp; &nbsp;   <xsl:when test="$sequence = 'blank' and $position = 'right'"&gt;
 &nbsp; &nbsp;  </xsl:when>

&nbsp; &nbsp; </xsl:choose>
&nbsp; </xsl:variable>

 &nbsp;  <!-- Does runtime parameter turn off blank page headers? -->

 &nbsp; 
<xsl:choose>
 &nbsp; &nbsp; 
<xsl:when test="$sequence='blank' and $headers.on.blank.pages=0">
 &nbsp; &nbsp; &nbsp; 
<!-- no output -->
 &nbsp; &nbsp; 
</xsl:when>
 &nbsp; 
<!-- titlepages have no headers -->
 &nbsp; &nbsp; 
<xsl:when test="$pageclass = 'titlepage'"> 
&nbsp; &nbsp; &nbsp;  
<!-- no output -->
 &nbsp; &nbsp; 
</xsl:when>
 &nbsp; &nbsp; 
<xsl:otherwise>
 &nbsp; &nbsp; &nbsp; 
<xsl:copy-of select="$candidate"/>
 &nbsp; &nbsp; 
</xsl:otherwise>;
 &nbsp; 
</xsl:choose>

</xsl:template>

</xsl:stylesheet >
-- 
Ron Catterall, Phd, DSc  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ;  &nbsp; &nbsp; &nbsp;  email: roncatterall.net
Prolongacion de Hidalgo 140    &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ; http://catterall.net/
San Felipe del Agua ; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ; tel: +52 951 520 1821
Oaxaca &nbsp; &nbsp;  68020&nbsp; Mexico&nbsp;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ;  &nbsp; &nbsp;   ; fax: +1 530 348 8309
--------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )