Fantastic, this works fine. Still it's not easy for me to wrap my head around 
all the modes in DocBook XSL.

Thanks,
Ben


-----Ursprüngliche Nachricht-----
Von: Bob Stayton [mailto:b...@sagehill.net] 
Gesendet: Freitag, 17. April 2015 20:56
An: Kallauch, Benjamin (EEIN); docbook-apps@lists.oasis-open.org
Betreff: Re: [docbook-apps] Using imageobject twice on title page fails (FO)

Hi,
If you take a peek inside the generated titlepage.templates.xsl, you'll 
see that each of the title pages uses different modes to process their 
elements:

recto page:

<xsl:template match="mediaobject" 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">
     <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/>
   </fo:block>
</xsl:template>

verso page:

<xsl:template match="mediaobject" mode="book.titlepage.verso.auto.mode">
   <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
         xsl:use-attribute-sets="book.titlepage.verso.style"
         space-before="1.5in">
     <xsl:apply-templates select="." mode="book.titlepage.verso.mode"/>
   </fo:block>
</xsl:template>

For many elements (including mediaobject), these modes eventually apply 
templates in the normal mode.  That's why you get duplicate ids.

You'll need to add a template to your customization layer something like 
this:

<xsl:template match="mediaobject" mode="book.titlepage.verso.mode">

   <!-- copy the contents of the normal template that matches on 
mediaobject (from fo/graphics.xsl) here, and remove the part that 
generates the id attribute. -->

</xsl:template>

(Add the namespace prefix d:mediaobject if you are using the namespaced 
stylesheets with DocBook 5).

Bob Stayton
Sagehill Enterprises
b...@sagehill.net

On 4/10/2015 5:52 AM, Kallauch, Benjamin (EEIN) wrote:
> Hi group.
> I want to display an image (mediaobject) twice on my book titlepages,
> first on the recto page and second on the following verso page.
> I made a simple extension to the "titlepage.templates.xml" file as
> proposed by Bob. Here is an XML snippet:
> <t:titlepage-content t:side="recto">
>            <mediaobject
>                    t:predicate="[position() = 1]"/>
> .
> <t:titlepage-content t:side="verso">
> .
>            <mediaobject
>                    space-before="1.5in"
>                    t:predicate="[position() = 1]" />
> .
> When I do this with other elements (i.e. <author>), everything is fine.
> But if I do this with an image, the FOP complains about a previously
> used ID:
> "javax.xml.transform.TransformerException:
> org.apache.fop.fo.ValidationException: Property ID "N4000E" (found on
> "fo:block") previously used; ID values must be unique within a document!"
> I checked the FO-Output and indeed found the image block twice with the
> same ID ("N4000E"). For the other elements there is no problem, because
> they don't get an ID (i.e. author).
> Question: How can I reuse my image more than once on the recto/verso
> title page.
> I could insert a second imageobject (same file) and fetch it with
> t:predicate="[position() = 2]" as a work around. But somehow I want to
> keep my code easy and clean.
> Can anyone help? Thanks.
> Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-h...@lists.oasis-open.org

Reply via email to