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] Incorrect page numbers in index for indextermswithin mediaobjects?


Thanks, Bob.

Unfortunately, these are all still resulting in the same page numbers in 
the index. I also tried with Antenna House, and have the same result.

--Scott

Bob Stayton wrote:
> Hi Scott,
> Well, looking at the template matching mediaobject in fo/graphics.xsl, the
> content of its objectinfo element is not processed, so no inline markers are
> laid down for those indexterms.  The indexterms are found during the global
> sweep of indexterms to build the index, but  there will be no target for
> those index entries to link to in the body of the document.
> 
> This customization of the mediaobject template works with XEP.  I can't get
> PDF images to work with FOP 0.95 at all, so I can't say if it works for
> that.  In this customization, I added a keep-together property for the
> container block, and I added an apply-templates to the indexterms so their
> markers will be included in the block container.
> 
> 
> <xsl:template match="mediaobject|mediaobjectco">
> 
>   <xsl:variable name="olist" select="imageobject|imageobjectco
>                      |videoobject|audioobject
>                      |textobject"/>
> 
>   <xsl:variable name="object.index">
>     <xsl:call-template name="select.mediaobject.index">
>       <xsl:with-param name="olist" select="$olist"/>
>       <xsl:with-param name="count" select="1"/>
>     </xsl:call-template>
>   </xsl:variable>
> 
>   <xsl:variable name="object" select="$olist[position() = $object.index]"/>
> 
>   <xsl:variable name="align">
>     <xsl:value-of select="$object/descendant::imagedata[@align][1]/@align"/>
>   </xsl:variable>
> 
>   <xsl:variable name="id">
>     <xsl:call-template name="object.id"/>
>   </xsl:variable>
> 
>   <fo:block id="{$id}" keep-together.within-column="always">
>     <xsl:if test="$align != '' ">
>       <xsl:attribute name="text-align">
>         <xsl:value-of select="$align"/>
>       </xsl:attribute>
>     </xsl:if>
> 
>     <xsl:apply-templates select="objectinfo/indexterm"/>
>     <xsl:apply-templates select="$object"/>
>     <xsl:apply-templates select="caption"/>
>   </fo:block>
> </xsl:template>
> 
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
> 
> 
> ----- Original Message -----
> From: "Scott Hudson" <scott.hudson@flatironssolutions.com>
> To: "Bob Stayton" <bobs@sagehill.net>
> Cc: "Hudson, Scott" <Scott.Hudson@flatironssolutions.com>; "John Brown"
> <johnbrown105@hotmail.com>; <docbook-apps@lists.oasis-open.org>
> Sent: Tuesday, September 30, 2008 2:44 PM
> Subject: Re: [docbook-apps] Incorrect page numbers in index for indexterms
> within mediaobjects?
> 
> 
>> Hi Bob,
>>
>> oddly enough, when I turn the xep.extensions on, I get that same set of
>> errors. If I process the file with fop1.extensions on and xep.extensions
>> off, the XEP produces the file and the index entries all pointing to the
>> title page of the chapter...
>>
>> If I process using FOP, I get the index as well, but the PDFs aren't
>> rendered on the actual pages.
>>
>> --Scott
>>
>> 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>
>>>>          <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
>>>>
>>>>
>>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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]