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: Re: [docbook-apps] [bug?] Wrong formating of <editor>


Hi Bob,

thanks again for your quick and detailed answer. I fixed my problem as
you suggested with a t:predicate. I also opened a bug at sourceforge:
https://sourceforge.net/tracker/?func=detail&atid=373747&aid=2687842&group_id=21935

best regards,
Aleksandar


Bob Stayton wrote:
> Hi Aleksandar,
> This is a bug in the stylesheets.  Basically one part of the
> stylesheet processes each editor, and another part processes the
> editors together. Here are the details.
>
> The titlepage spec stylesheet generates
> templates that match on elements specified in the titlepage spec file,
> such
> as elements like editor.
>
>  <xsl:apply-templates mode="book.titlepage.recto.auto.mode"
> select="info/editor"/>
>
> This applies the following generated titlepage template with your specs:
>
> <xsl:template match="editor" mode="book.titlepage.recto.auto.mode">
> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
> xsl:use-attribute-sets="book.titlepage.recto.style"
> font-size="14pt" space-before="5mm">
> <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
> </fo:block>
> </xsl:template>
>
> That's why two blocks are being generated, because that template
> matches on
> each of the editor elements.  If you have more editors, you will have
> more
> empty blocks.
>
> This arrangement works well when each element should be in its own block.
> But editors are merged together into one block.  The generated template
> eventually does
> apply-templates mode="titlepage.mode", and those templates are located in
> fo/titlepage.xsl.   The general match on "editor" does nothing.  There
> is a
> special template with match="editor[1]" (the first editor element) that
> assembles the list of editors.  Here are those templates:
>
> <xsl:template match="editor" mode="titlepage.mode">
>  <!-- The first editor is dealt with in the following template,
>       which in turn displays all editors of the same mode. -->
> </xsl:template>
>
> <xsl:template match="editor[1]" priority="2" mode="titlepage.mode">
>  <xsl:call-template name="gentext.edited.by"/>
>  <xsl:call-template name="gentext.space"/>
>  <xsl:call-template name="person.name.list">
>    <xsl:with-param name="person.list" select="../editor"/>
>  </xsl:call-template>
> </xsl:template>
>
> The problem is that this takes place after the titlepage spec template
> generates the fo:block for each editor.  Applying these templates to the
> first editor element matches on "editor[1]" and generates the list in the
> first block.  The second block is blank because the application of the
> templates to the second editor do not match on "editor[1]", but only on
> "editor", and that template does nothing.
>
> One workaround for your situation is to add an empty template in
> mode="book.titlepage.recto.auto.mode" so that the second (or subsequent)
> editor does not generate the empty block:
>
> <xsl:template match="editor[position() != 1]"
> mode="book.titlepage.recto.auto.mode">
> </xsl:template>
>
> The first editor will match on the generated template, any additional
> editors will match on this template and do nothing.
>
> The other solution is to use a little-known feature of the titlepage spec
> mechanism which lets you specify a predicate to be used in the match. 
> Your
> titlepage spec file could say:
>
> <editor t:predicate="[position() = 1]" font-size="14pt"
> space-before="5mm" />
>
> The predicate is specifed as the content of an attribute named t:predicte
> (it must have the titlepage namespace on the attribute so it is not
> interpreted as a formatting attribute like font-size).   After
> recompiling
> your titlepage template file, it should have a line like this:
>
> <xsl:apply-templates mode="book.titlepage.recto.auto.mode"
> select="d:info/d:editor[position() = 1]"/>
>
> Now only the first editor is processed at the first step, and others are
> ignored.  Since the template for the first editor outputs all the
> rest, this
> is the behavior you need.
>
> Could you please file a bug report on the SourceForge site for this?
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>
>
> ----- Original Message ----- From: "Aleksandar Kanchev"
> <kanchev@in.tum.de>
> To: <docbook-apps@lists.oasis-open.org>
> Sent: Saturday, March 14, 2009 7:47 PM
> Subject: [docbook-apps] [bug?] Wrong formating of <editor>
>
>
>> Hello,
>>
>> I've defined two editors:
>> <book><info>
>>    <editor>
>>
>> <personname><honorific>...</honorific><firstname>Editor1</firstname><surname>..</surname></personname>
>>
>>        <affiliation><orgname>...</orgname></affiliation>
>>    </editor>
>>    <editor>
>>
>> <personname><honorific>...</honorific><firstname>Editor2</firstname><surname>..</surname></personname>
>>
>>        <affiliation><orgname>...</orgname></affiliation>
>>    </editor>
>> </info>...</book>
>>
>> I've customized the titlepage to include the editors:
>> <t:titlepage t:element="book" t:wrapper="fo:block"
>> font-family="{$title.fontset}">
>>    <t:titlepage-content t:side="recto">
>>        ...
>>        <editor font-size="14pt" space-before="5mm" />
>>        ...
>>    </t:titlepage-content>
>>    ...
>> </t:titlepage>
>>
>> After generating the FO and then the PDF (with FOP) I've noticed an
>> annoying extra space is being output after the editors. The editors
>> themselves are printed correctly with their respective names
>> concatenated with the "and" word in a single fo:block. I've checked the
>> generated FO file and found out that the same fo:block for the editors
>> is being output twiche, while the second one is completely empty.
>>
>> Is there a simple way to fix this? I'm currently using docbook5 with
>> docbook-xsl-1.74.
>>
>> best regards,
>> Aleksandar
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>
>>
>>
>



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