[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Incorrect page numbers in index for indextermswithin mediaobjects?
No special customization on indexterms. Here's my custom layer:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import
href="file:///C:/Docbook/docbook-xsl-1.74.0/fo/docbook.xsl"/>
<xsl:param name="draft.mode">no</xsl:param>
<xsl:param name="fop1.extensions">1</xsl:param>
<xsl:template name="user.pagemasters">
<fo:simple-page-master master-name="back-odd-body-only"
page-width="{$page.width}"
page-height="{$page.height}"
margin-top="0"
margin-bottom="0"
margin-left="0"
margin-right="0">
<xsl:if test="$axf.extensions != 0">
<xsl:call-template name="axf-page-master-properties">
<xsl:with-param
name="page.master">back-odd-body-only</xsl:with-param>
</xsl:call-template>
</xsl:if>
<fo:region-body margin-bottom="0"
margin-top="0"
column-gap="{$column.gap.back}"
column-count="{$column.count.back}">
</fo:region-body>
<fo:region-before region-name="xsl-region-before-even"
extent="{$region.before.extent}"
display-align="before"/>
<fo:region-after region-name="xsl-region-after-even"
extent="{$region.after.extent}"
display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="back-even-body-only"
page-width="{$page.width}"
page-height="{$page.height}"
margin-top="0"
margin-bottom="0"
margin-left="0"
margin-right="0">
<xsl:if test="$axf.extensions != 0">
<xsl:call-template name="axf-page-master-properties">
<xsl:with-param
name="page.master">back-even-body-only</xsl:with-param>
</xsl:call-template>
</xsl:if>
<fo:region-body margin-bottom="0"
margin-top="0"
column-gap="{$column.gap.back}"
column-count="{$column.count.back}">
</fo:region-body>
<fo:region-before region-name="xsl-region-before-even"
extent="{$region.before.extent}"
display-align="before"/>
<fo:region-after region-name="xsl-region-after-even"
extent="{$region.after.extent}"
display-align="after"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="back-body-only">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference
master-reference="blank"
blank-or-not-blank="blank"/>
<fo:conditional-page-master-reference
master-reference="back-first"
page-position="first"/>
<fo:conditional-page-master-reference
master-reference="back-odd-body-only"
odd-or-even="odd"/>
<fo:conditional-page-master-reference odd-or-even="even">
<xsl:attribute name="master-reference">
<xsl:choose>
<xsl:when test="$double.sided
!=0">back-even-body-only</xsl:when>
<xsl:otherwise>back-odd-body-only</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</fo:conditional-page-master-reference>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</xsl:template>
<xsl:template name="select.user.pagemaster">
<xsl:param name="element"/>
<xsl:param name="pageclass"/>
<xsl:param name="default-pagemaster"/>
<!-- Return my customized title page master name if for titlepage,
otherwise return the default -->
<xsl:choose>
<xsl:when test="@role = 'non-reflow'">back-body-only</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$default-pagemaster"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="chapter[@role='non-reflow']">
<xsl:apply-imports />
</xsl:template>
<xsl:template match="chapter[@role='non-reflow']/mediaobject">
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
font-size="0"
line-height="0" break-before="page"
break-after="page" start-indent="0" end-indent="0">
<xsl:apply-imports/>
</fo:block>
</xsl:template>
<xsl:template match="processing-instruction('hard-pagebreak')">
<fo:block break-before='page'/>
</xsl:template>
</xsl:stylesheet>
Bob Stayton wrote:
> Hi Scott,
> I tried processing your chapter, and XEP reports:
>
> [error] no entries for index key 'TEST'
> [error] no entries for index key 'TEST2'
> [error] no entries for index key 'TEST3'
>
> and there are no page numbers in the index. Did you do some customization
> regarding indexterms inside objectinfo? I'm not getting any index markers
> at all for those indexterms.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>
>
> ----- Original Message -----
> From: "Scott Hudson" <scott.hudson@flatironssolutions.com>
> To: "Scott Hudson" <scott.hudson@flatironssolutions.com>
> Cc: "John Brown" <johnbrown105@hotmail.com>;
> <docbook-apps@lists.oasis-open.org>
> Sent: Tuesday, September 30, 2008 1:23 PM
> Subject: [docbook-apps] Incorrect page numbers in index for indexterms
> within mediaobjects?
>
>
>> Folks,
>>
>> Now that I can include external pages in my document, I want to be able to
>> add indexterms to them. When I generate the index, however, the page
>> numbers aren't quite right. These should each end up on a separate page.
>> Instead, I get:
>> T
>> TEST, 144, 144
>> TEST2, 144
>> TEST3, 144
>>
>> Here's my source:
>> <chapter role="non-reflow">
>> <title>Case Study</title>
>> <mediaobject>
>>
>> <objectinfo><indexterm><primary>TEST</primary></indexterm></objectinfo>
>> <imageobject>
>> <imagedata fileref="casestudy_001.pdf" scalefit="1"
>> width="100%" contentdepth="100%" format="PDF"/>
>> </imageobject>
>> </mediaobject>
>> <para/>
>> <mediaobject>
>>
>> <objectinfo><indexterm><primary>TEST2</primary></indexterm></objectinfo>
>> <imageobject>
>> <imagedata fileref="casestudy_002.pdf" scalefit="1"
>> width="100%" contentdepth="100%" format="PDF"/>
>> </imageobject>
>> </mediaobject>
>> <para/>
>> <mediaobject>
>>
>> <objectinfo><indexterm><primary>TEST3</primary></indexterm></objectinfo>
>> <imageobject>
>> <imagedata fileref="casestudy_003.pdf" scalefit="1"
>> width="100%" contentdepth="100%" format="PDF"/>
>> </imageobject>
>> </mediaobject>
>> <para/>
>> <mediaobject>
>>
>> <objectinfo><indexterm><primary>TEST</primary></indexterm></objectinfo>
>> <imageobject>
>> <imagedata fileref="casestudy_004.pdf" scalefit="1"
>> width="100%" contentdepth="100%" format="PDF"/>
>> </imageobject>
>> </mediaobject>
>> </chapter>
>>
>> Ideas?
>>
>> Thanks,
>>
>> --Scott
>>
>> Scott Hudson wrote:
>>> Thanks, John! I had to add an additional template to contain the
>>> chapter, but otherwise works like a charm!
>>>
>>> <xsl:template match="chapter[@role='external-doc']">
>>> <xsl:apply-imports />
>>> </xsl:template>
>>>
>>> <xsl:template match="chapter[@role='external-doc']/mediaobject">
>>> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
>>> font-size="0"
>>> line-height="0" break-before="page"
>>> break-after="page" start-indent="0" end-indent="0">
>>> <xsl:apply-imports/>
>>> </fo:block>
>>> </xsl:template>
>>>
>>> Best regards,
>>>
>>> --Scott
>>>
>>>
>>> John Brown wrote:
>>>> Scott Hudson <scott.hudson <at> flatironssolutions.com> writes:
>>>>
>>>>> John Brown and Jirka Kosek both had good suggestions to split the case
>>>>> study into individual pages using pdftk and then use mediaobject.
>>>>>
>>>>> This approach seems to work pretty well, although the generated index
>>>>> entries don't seem to point to the same page where the image is
>>>>> rendered
>>>>> (pretty close, though).
>>>>>
>>>> Never used indexterm, so I have no idea.
>>>>
>>>> <! -- Docbook code snipped -->
>>>>
>>>>> The biggest problem I'm having now is that the image doesn't appear to
>>>>> scale the entire width of the page. I'm using XEP, but FOP 0.95 does
>>>>> the
>>>>> same (or worse).
>>>>>
>>>>> What am I missing? I've tried width="100%" but that also errors. I've
>>>>> also tried setting the default.image.width param, but that doesn't seem
>>>>> to work either.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> Thanks and best regards,
>>>>>
>>>>> --Scott
>>>> DocBook is making the image fit within the margins. The answer is
>>>> to define custom page masters with left and right margins = 0.
>>>> Maybe you will also want to suppress the normal DocBook headers
>>>> and footers with titles and page numbers.
>>>>
>>>> The following code allows you to write
>>>> <appendix role='external-doc'>
>>>> <mediaobject>
>>>> ...
>>>> </mediaobject>
>>>> <mediaobject>
>>>> ...
>>>> </mediaobject>
>>>> <!-- etc. -->
>>>> </appendix>
>>>>
>>>> If your external page is the same size as your DocBook page, it will
>>>> take up the entire page.
>>>>
>>>> <xsl:template name="user.pagemasters">
>>>> <fo:simple-page-master master-name="back-odd-body-only"
>>>> page-width="{$page.width}"
>>>> page-height="{$page.height}"
>>>> margin-top="0"
>>>> margin-bottom="0"
>>>> margin-left="0"
>>>> margin-right="0">
>>>> <xsl:if test="$axf.extensions != 0">
>>>> <xsl:call-template name="axf-page-master-properties">
>>>> <xsl:with-param
>>>> name="page.master">back-odd-body-only</xsl:with-param>
>>>> </xsl:call-template>
>>>> </xsl:if>
>>>> <fo:region-body margin-bottom="0"
>>>> margin-top="0"
>>>> column-gap="{$column.gap.back}"
>>>> column-count="{$column.count.back}">
>>>> </fo:region-body>
>>>>
>>>> </fo:simple-page-master>
>>>>
>>>> <fo:simple-page-master master-name="back-even-body-only"
>>>> page-width="{$page.width}"
>>>> page-height="{$page.height}"
>>>> margin-top="0"
>>>> margin-bottom="0"
>>>> margin-left="0"
>>>> margin-right="0">
>>>> <xsl:if test="$axf.extensions != 0">
>>>> <xsl:call-template name="axf-page-master-properties">
>>>> <xsl:with-param
>>>> name="page.master">back-even-body-only</xsl:with-param>
>>>> </xsl:call-template>
>>>> </xsl:if>
>>>> <fo:region-body margin-bottom="0"
>>>> margin-top="0"
>>>> column-gap="{$column.gap.back}"
>>>> column-count="{$column.count.back}">
>>>> </fo:region-body>
>>>> </fo:simple-page-master>
>>>>
>>>> <fo:page-sequence-master master-name="back-body-only">
>>>> <fo:repeatable-page-master-alternatives>
>>>> <fo:conditional-page-master-reference master-reference="blank"
>>>>
>>>> blank-or-not-blank="blank"/>
>>>> <fo:conditional-page-master-reference
>>>> master-reference="back-first"
>>>> page-position="first"/>
>>>> <fo:conditional-page-master-reference
>>>> master-reference="back-odd-body-only"
>>>> odd-or-even="odd"/>
>>>> <fo:conditional-page-master-reference odd-or-even="even">
>>>> <xsl:attribute name="master-reference">
>>>> <xsl:choose>
>>>> <xsl:when test="$double.sided
>>>> !=0">back-even-body-only</xsl:when>
>>>> <xsl:otherwise>back-odd-body-only</xsl:otherwise>
>>>> </xsl:choose>
>>>> </xsl:attribute>
>>>> </fo:conditional-page-master-reference>
>>>> </fo:repeatable-page-master-alternatives>
>>>> </fo:page-sequence-master>
>>>>
>>>> </xsl:template>
>>>>
>>>> <xsl:template name="select.user.pagemaster">
>>>> <xsl:param name="element"/>
>>>> <xsl:param name="pageclass"/>
>>>> <xsl:param name="default-pagemaster"/>
>>>>
>>>> <!-- Return my customized title page master name if for titlepage,
>>>> otherwise return the default -->
>>>>
>>>> <xsl:choose>
>>>> <xsl:when test="@role = 'external-doc'">
>>>> <xsl:value-of select="'back-body-only'" />
>>>> </xsl:when>
>>>> <xsl:otherwise>
>>>> <xsl:value-of select="$default-pagemaster"/>
>>>> </xsl:otherwise>
>>>> </xsl:choose>
>>>> </xsl:template>
>>>>
>>>> <xsl:template match="d:appendix[@role='external-doc']/d:mediaobject">
>>>> <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" font-size="0"
>>>> line-height="0" break-before="page"
>>>> break-after="page" start-indent="0" end-indent="0">
>>>> <xsl:apply-imports/>
>>>> </fo:block>
>>>> </xsl:template>
>>>>
>>>> I am not sure if the back-body-even-only and back-body-odd-only
>>>> page masteres are strictly necessary.
>>>>
>>>> See the following thread:
>>>> http://thread.gmane.org/gmane.text.docbook.apps/19707
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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]