OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Titleabbrev in outer margin

Hello list.

I am not a XSL programmer, so I kindly ask you to bear with me. I have  
a docbook compilant XML file (an operating instruction) that contains  
several different languages. Basic outline of the XML file is:

   <article lang="en">
     <title />
     <titleabbrev>English</titleabbrev >
   <article lang="de">
     <title />

What I like to accomplish is putting the language names into the outer  
margin of my pdf. I found an example in the mailing list archives (http://www.mail-archive.com/docbook-apps@lists.oasis-open.org/msg12243.html 
) which describes a way to extend the pagesetup.xsl template with a  
static content region.

After some tweaks, I actually managed to incorporate the example into  
my customization layer. However, I need to find a way to calculate an  
offset value for the top position of the fo-block that contains the  
language name. Whenever the language name changes, the offset should  
increase (and the fo block moves down). Right now, those fo-block  
containers always have the same position.

My idea was to get the position of the parent element in the xml tree  
(the article element) and calculate the offset based on that. But I  
must be doing something wrong. Here is what I have come up with so far.

1) Changed the pagesetup.xsl template:
<xsl:template match="*" mode="running.head.mode">
   <xsl:param name="master-reference" select="'unknown'"/>
   <xsl:param name="gentext-key" select="local-name(.)"/>

   <!-- remove -draft from reference -->
   <xsl:variable name="pageclass">
       <xsl:when test="contains($master-reference, '-draft')">
         <xsl:value-of select="substring-before($master-reference,'- 
         <xsl:value-of select="$master-reference"/>
   <fo:static-content flow-name="xsl-region-before-blank">
     <fo:block xsl:use-attribute-sets="header.content.properties">
       <xsl:call-template name="header.table">
         <xsl:with-param name="pageclass" select="$pageclass"/>
         <xsl:with-param name="sequence" select="'blank'"/>
         <xsl:with-param name="gentext-key" select="$gentext-key"/>

     <!-- Sidebar output: -->
     <xsl:call-template name="article.language.bar"/>


2) Template for the sidebar

<xsl:template name="article.language.bar">

   <!-- calculate the top offset -->
   <xsl:call-template name="parent.position">
     <xsl:with-param name="node" select="ancestor-or-self::article" />

       top="0.5in" <--- This value should be calculated with the offset
       z-index="1" >
     <fo:block padding="0.05in" background-color="#ddd" font- 
size="1em" color="white" font-weight="bold">
       <xsl:apply-templates select="." mode="titleabbrev.markup" />

3) Template for calculating the position of the article element

<xsl:template name="parent.position">
   <xsl:param name="node" />
   <xsl:param name="position" select="position()" />
   <xsl:message>Position is: <xsl:value-of select="$position" /></ 

But, the position is always 1. Is the basic idea of calculating the  
offset value for the top position with help of the parent element  
position feasible or is there an easier way?

Kind regards,

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]