« Return to Thread: Author name in header or footer
Hi !
Ok, I have a simple solution :
In each template header and footer, I
created variables
For book’s title :
<xsl:variable
name="BookTitle">
<xsl:choose>
<xsl:when
test="//book/title">
<xsl:value-of
select="//book/title"/>
</xsl:when>
<xsl:otherwise>
<!-- nop -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
For Author :
<xsl:variable
name="Author">
<xsl:choose>
<xsl:when
test="//authorgroup/author[1]/firstname">
<xsl:value-of
select="//authorgroup/author[1]/firstname"/>
</xsl:when>
<xsl:otherwise>
<!-- nop -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
For revision :
<xsl:variable
name="RevInfo">
<xsl:choose>
<xsl:when
test="//revhistory/revision[last()]/revnumber">
<xsl:text>Version
</xsl:text>
<xsl:value-of
select="//revhistory/revision[last()]/revnumber"/>
</xsl:when>
<xsl:otherwise>
<!-- nop -->
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Then, I used these variables into <xsl:template
name="footer.content"> or <xsl:template
name="header.content">
<xsl:value-of
select="$BookTitle"/>, etc.
Cordialement,
![]()
____________________________________________
Christopher COMPAGNON
AXA GROUP SOLUTIONS - Procurement, BI Supply
Département Solutions
Business Intelligence
Domaine BI France - Reporting Opérationnel
( 01 44 45 04 16 (55 04
16)
E-mail: christopher.compagnon.alti@...
____________________________________________
Pensez à l'environnement avant d'imprimer ce message
De : Compagnon
Christopher [mailto:christopher.compagnon.alti@...]
Envoyé : lundi 29 juin 2009
15:58
À : Damon Mannion
Cc :
docbook-apps@...
Objet : RE: [docbook-apps]
Author name in header or footer
Hi !
Thank you for this tip but I find it
with no elegance and simplicity.
Cordialement,
![]()
____________________________________________
Christopher COMPAGNON
AXA GROUP SOLUTIONS - Procurement, BI Supply
Département Solutions
Business Intelligence
Domaine BI France - Reporting Opérationnel
( 01 44 45 04 16 (55 04
16)
E-mail: christopher.compagnon.alti@...
____________________________________________
Pensez à l'environnement avant d'imprimer ce message
De : Damon Mannion
[mailto:damon@...]
Envoyé : dimanche 28 juin
2009 18:25
À : Compagnon Christopher
Cc :
docbook-apps@...
Objet : Re: [docbook-apps]
Author name in header or footer
Hi
You may find the code below helpful.
The mistakes I made in getting this to work was:
- not setting the namespace correctly
- not setting up default handling for the book meta data
Damon
<!--********
document meta data
element handling
With the way docbook is
structured, default handling for all book meta data is explicitly switched off,
this is to stop
accidental processing. It is switched on for <date> because that element
is used across the
document. However (say)
<legalnotice> is not handled. The solution is to created a new mode for
the titlepage
template, then apply
the usual processing. If this is not here, compile errors and generated. If you
use
xsl-value, then you only
get the text appearing, and not the processing of the embedded trademark
element
within legalnotice.
Hence this needs to be here.
********-->
<xsl:template
match="/d:book/d:info/d:legalnotice"
mode="book.titlepage.footer">
<xsl:apply-templates
/>
</xsl:template>
<!--********
footer content
********-->
<xsl:template
name="footer.content">
<xsl:param
name="pageclass" select="''"/>
<xsl:param
name="sequence" select="''"/>
<xsl:param
name="position" select="''"/>
<xsl:param
name="gentext-key" select="''"/>
<fo:block>
<xsl:if
test="not ($pageclass = 'coversequence' and $sequence = 'first')">
<xsl:choose>
<xsl:when
test="$position = 'left'">
<xsl:apply-templates
select="/d:book/d:info/d:date"/>
<fo:block/>
<xsl:text>v:
</xsl:text>
<xsl:apply-templates
select="/d:book/d:info/d:revhistory/d:revision[last()]/d:revnumber"/>
</xsl:when>
<xsl:when
test="$position = 'center'">
<xsl:apply-templates
select="/d:book/d:info/d:legalnotice"
mode="book.titlepage.footer"/>
<fo:block/>
<xsl:apply-templates
select="/d:book/d:info/d:copyright"
mode="titlepage.mode"/>
</xsl:when>
<xsl:when
test="$position = 'right'">
<xsl:text>Page:
</xsl:text>
<fo:page-number/>
</xsl:when>
</xsl:choose>
</xsl:if>
</fo:block>
</xsl:template>
On 26 Jun 2009, at 15:34, Compagnon Christopher wrote:
Hi,
I would like to
produce a PDF file with docbook-xsl fo stylesheets with authorname in header or
footer. All examples I find on the web don’t work.
And the same question
with the book’s title.
Cordialement,
____________________________________________
Christopher COMPAGNON
AXA GROUP SOLUTIONS - Procurement, BI Supply
Département Solutions Business
Intelligence
Domaine BI France - Reporting Opérationnel
( 01 44 45 04 16 (55
04 16)
E-mail: christopher.compagnon.alti@...
____________________________________________
<image002.jpg>Pensez
à l'environnement avant d'imprimer ce message
« Return to Thread: Author name in header or footer
| Free embeddable forum powered by Nabble | Forum Help |