Re: [docbook-apps] Adding releaseinfo to variable (to display in footer)

From
Bob Stayton <>
Date
2013-10-14T17:35:21+00:00
ID
066EA3340C8F4FF8ABACAA1A8324A79A@totoro
Thread
Re: [docbook-apps] Adding releaseinfo to variable (to display in footer)
Hi Jen,

If you are using the namespaced version of the stylesheets 
(docbook-xsl-ns), then you need to add the  namespace to any element 
references in the stylesheet:

 

d:releaseinfo

 

Bob Stayton
Sagehill Enterprises


From: Jen 

Sent: Monday, October 14, 2013 5:51 AM

To:  

Subject: [docbook-apps] Adding releaseinfo to variable (to display 
in footer)

Hi everyone, 

Hoping for a little help yet again :) I'd like my footers to display the 
value of the <releaseinfo> element (in the example below, 3.2), but they 
are empty in PDF output. I'm pretty sure that the variable that should hold the 
version never gets populated, but I don't understand why.

(In the future, I'd like to have productname+releaseinfo, but I got stuck 
before having to figure out concatenations.)

In my XML, I have this:

<book xmlns="http://docbook.org/ns/docbook" 
version="5.0">

<info>

<title>CTU User Guide</title>

<releaseinfo>3.2</releaseinfo>

<productname>CTU></productname>

</info>

[...]

</book>

In my XSL, I have:

<xsl:variable 
name="Version">

<xsl:when 
test="//releaseinfo">

<xsl:choose>

<xsl:text>CTU 
</xsl:text>

<xsl:value-of 
select="//releaseinfo"/>

</xsl:when>

<xsl:otherwise>

                  CTU 
3.0

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<xsl:choose>

<xsl:when 
test="$sequence='blank'">

<xsl:choose>

<xsl:when test="$double.sided != 0 
and $position = 'left'">

<xsl:value-of 
select="$Version"/>

</xsl:when>

<xsl:when test="$double.sided = 0 
and $position = 'center'">

<!-- nop -->

</xsl:when>

<xsl:otherwise>

<fo:page-number/>

</xsl:otherwise>

</xsl:choose>

</xsl:when>

<xsl:when 
test="$pageclass='titlepage'">

<!-- nop: other titlepage 
sequences have no footer -->

</xsl:when>

<xsl:when test="$double.sided != 0 
and $sequence = 'even' and $position='left'">

<fo:page-number/>

</xsl:when>

<xsl:when test="$double.sided != 0 
and $sequence = 'odd' and $position='right'">

<fo:page-number/>

</xsl:when>

<xsl:when test="$double.sided = 0 
and $position='right'">

<fo:page-number/>

</xsl:when>

<xsl:when test="$double.sided != 0 
and $sequence = 'odd' and $position='left'">

<xsl:value-of 
select="$Version"/>

</xsl:when>

<xsl:when test="$double.sided != 0 
and $sequence = 'even' and $position='right'">

<xsl:value-of 
select="$Version"/>

</xsl:when>

<xsl:when test="$double.sided = 0 
and $position='left'">

<xsl:value-of 
select="$Version"/>

</xsl:when>

<xsl:otherwise>

<!-- nop -->

</xsl:otherwise>

</xsl:choose>

</xsl:template>

(This part is a bit messy, I think, but I inherited the customization layer 
and I don't want to mess with it too much.)

If anyone can shed any light, it would help a ton - I'm very new to all 
this and it gets confusing at times.

Thanks,

Jen