Scott Hudson | 1 Oct 01:07 2008

Re: Incorrect page numbers in index for indexterms within 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">
(Continue reading)

Bob Stayton | 1 Oct 01:59 2008
Picon

Re: Incorrect page numbers in index for indexterms within mediaobjects?

Well, this is more complicated than it should be, it seems.
 
That customization does work for me when I process with xep.extensions=1 and XEP 4.13.  I get this in the index:
 

Index

T
TEST, 1, 4
TEST2, 2
TEST3, 3

When xep.extensions=1, indexterms  are handled as a special case in the stylesheet because of the extensions that XEP provides for collapsing duplicate page numbers and creating ranges of pages.  So there is no comparing XEP with other FO processors when it comes to indexterms.
 
My customization should work in Antenna House, but there are two bugs in the template named info.reference which is used when handling indexterms inside info elements.  That template comes into play for non-XEP index processing, that is, when xep.extensions = 0. 
 
This customization of info.reference fixes the problem in Antenna House.  I added ancestor::mediaobject to the list for the variable named target since it was missing, and I changed the [1] predicate to [position() = last()], because when ancestor lists are placed in parens, they are converted to document order rather than most recent ancestor order.
 
 
<xsl:template name="info.reference">
  <!-- This is not perfect. It doesn't treat indexterm inside info element as a range covering whole parent of info.
       It also not work when there is no ID generated for parent element. But it works in the most common cases. -->
  <xsl:param name="scope" select="."/>
  <xsl:param name="role" select="''"/>
  <xsl:param name="type" select="''"/>
 
  <xsl:variable name="target" select="(ancestor::appendix|ancestor::article|ancestor::bibliography|ancestor::book|
                                       ancestor::chapter|ancestor::glossary|ancestor::part|ancestor::preface|
                                       ancestor::refentry|ancestor::reference|ancestor::refsect1|ancestor::refsect2|
                                       ancestor::refsect3|ancestor::refsection|ancestor::refsynopsisdiv|
                                       ancestor::sect1|ancestor::sect2|ancestor::sect3|ancestor::sect4|ancestor::sect5|
                                       ancestor::section|ancestor::setindex|ancestor::set|ancestor::sidebar|ancestor::mediaobject)[&scope;]"/>
 
  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="object" select="$target[position() = last()]"/>
    </xsl:call-template>
  </xsl:variable>
 
  <fo:basic-link internal-destination="{$id}"
                 xsl:use-attribute-sets="index.page.number.properties">
    <fo:page-number-citation ref-id="{$id}"/>
  </fo:basic-link>
</xsl:template>
 
 
 
Bob Stayton
Sagehill Enterprises
bobs <at> sagehill.net
 
 
----- Original Message -----
To: "Bob Stayton" <bobs <at> sagehill.net>
Sent: Tuesday, September 30, 2008 4:07 PM
Subject: Re: [docbook-apps] Incorrect page numbers in index for indexterms within 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[ <at> align][1]/ <at> 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 <at> sagehill.net
>>
>>
>> ----- Original Message -----
>> From: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>> To: "Bob Stayton" <bobs <at> sagehill.net>
>> Cc: "Hudson, Scott" <Scott.Hudson <at> flatironssolutions.com>; "John Brown"
>> <johnbrown105 <at> hotmail.com>; <docbook-apps <at> 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 <at> sagehill.net
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>>>> To: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>>>> Cc: "John Brown" <johnbrown105 <at> hotmail.com>;
>>>> <docbook-apps <at> 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[ <at> role='external-doc']">
>>>>>>          <xsl:apply-imports />
>>>>>>      </xsl:template>
>>>>>>
>>>>>>      <xsl:template match="chapter[ <at> 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=" <at> 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[ <at> 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 <at> lists.oasis-open.org
>>>>>>> For additional commands, e-mail:
>>>>>>> docbook-apps-help <at> lists.oasis-open.org
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>>>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>
>
>
Lily Galle | 1 Oct 13:13 2008
Picon
Picon

double.sided Parameter Problem

Dear all,

(I got the answer for my last question. Thank you very much, Bob!)

If I add 

<xsl:param name="double.sided">1</xsl:param>

In my xsl file, then the transformation fails. If I add 

<xsl:param name="double.sided">0</xsl:param>

Then it woks again. But I want to change this default value. I need double-sided layout.

(If you need more information: what I use is “oXygen” xml editor. It works well till now.) I tried
different transformers like Xalan, Xsltproc, Saxon. All of them failed if “double.sided” is set to “1”.

 Please look at the error message below. At the end of this mail are “myXSL.xsl” and
“mydocBook.xml” files. Thanks for any help. 

With the “Xalan” Transformer I get the following error description if I set the “double.sided”
parameter to “1”: 

SystemID: C:\Documents and Settings\HuaXia\Desktop\docbook-xsl-1.74.0\fo\mydocBook.xml
Description: The process 'FOP' ended with code: 1.
The error was: 
01.10.2008 12:13:05 org.apache.fop.hyphenation.Hyphenator getHyphenationTree
SCHWERWIEGEND: Couldn't find hyphenation pattern de
01.10.2008 12:13:05 org.apache.fop.cli.Main startFOP
SCHWERWIEGEND: Exception
java.lang.IllegalStateException: Flow 'xsl-region-body' does not map to the region-body in
page-master 'blank'.  FOP presently does not support this.
	at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
	at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
	at org.apache.fop.cli.Main.startFOP(Main.java:166)
	at org.apache.fop.cli.Main.main(Main.java:197)

---------

java.lang.IllegalStateException: Flow 'xsl-region-body' does not map to the region-body in
page-master 'blank'.  FOP presently does not support this.
	at org.apache.fop.layoutmgr.PageProvider.cacheNextPage(PageProvider.java:275)
	at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:221)
	at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:185)
	at org.apache.fop.layoutmgr.PageSequenceLayoutManager.makeNewPage(PageSequenceLayoutManager.java:382)
	at org.apache.fop.layoutmgr.PageSequenceLayoutManager.doForcePageCount(PageSequenceLayoutManager.java:486)
	at org.apache.fop.area.AreaTreeHandler.finishPrevPageSequence(AreaTreeHandler.java:185)
	at org.apache.fop.area.AreaTreeHandler.startPageSequence(AreaTreeHandler.java:198)
	at org.apache.fop.fo.pagination.PageSequence.startOfNode(PageSequence.java:136)
	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:329)
	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
	at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362)
	at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197)
	at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:364)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:371)
	at net.sf.saxon.event.Sender.send(Sender.java:185)
	at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:29)
	at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
	at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
	at org.apache.fop.cli.Main.startFOP(Main.java:166)
	at org.apache.fop.cli.Main.main(Main.java:197)

The following “myXSL.xsl” works well: 

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:fo="http://www.w3.org/1999/XSL/Format"  
  xmlns:exsl="http://exslt.org/common" version="1.0" 
  exclude-result-prefixes="exsl"> 

  <xsl:import href = "docbook.xsl"></xsl:import> 
 <xsl:param name="double.sided">0</xsl:param>

  </xsl:stylesheet>

After I set the parameter “double.sided” to “1”, the file looks like the following and the
transformation fails: 

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:fo="http://www.w3.org/1999/XSL/Format"  
  xmlns:exsl="http://exslt.org/common" version="1.0" 
  exclude-result-prefixes="exsl"> 

  <xsl:import href = "docbook.xsl"></xsl:import> 
  <xsl:param name="double.sided">1</xsl:param>

  </xsl:stylesheet>

My “mydocBook.xml” is written like this: 

<?xml version="1.0" encoding="UTF-8"?>
<book version="5.0" xml:lang="de" xmlns="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude">

    <title>The Big Book Title</title>       

    <chapter>
        <title>Team Management</title>        
        <sect1>         
            <title> Introduction</title>
            <para>
                The first paragraph about team management.
            </para>     
            <para>
                The second paragraph.
            </para>   
        </sect1>    
    </chapter>

    <chapter>
        <title>Risk Management</title>
        <para>Something about risk management are here.</para>
    </chapter>

</book>

--

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
Scott Hudson | 1 Oct 22:53 2008

Re: Incorrect page numbers in index for indexterms within mediaobjects?

Thanks, Bob! This is working like a charm in both XEP and Antenna House!

Best regards,

--Scott

Bob Stayton wrote:
Well, this is more complicated than it should be, it seems.
 
That customization does work for me when I process with xep.extensions=1 and XEP 4.13.  I get this in the index:
 

Index

T
TEST, 1, 4
TEST2, 2
TEST3, 3

When xep.extensions=1, indexterms  are handled as a special case in the stylesheet because of the extensions that XEP provides for collapsing duplicate page numbers and creating ranges of pages.  So there is no comparing XEP with other FO processors when it comes to indexterms.
 
My customization should work in Antenna House, but there are two bugs in the template named info.reference which is used when handling indexterms inside info elements.  That template comes into play for non-XEP index processing, that is, when xep.extensions = 0. 
 
This customization of info.reference fixes the problem in Antenna House.  I added ancestor::mediaobject to the list for the variable named target since it was missing, and I changed the [1] predicate to [position() = last()], because when ancestor lists are placed in parens, they are converted to document order rather than most recent ancestor order.
 
 
<xsl:template name="info.reference">
  <!-- This is not perfect. It doesn't treat indexterm inside info element as a range covering whole parent of info.
       It also not work when there is no ID generated for parent element. But it works in the most common cases. -->
  <xsl:param name="scope" select="."/>
  <xsl:param name="role" select="''"/>
  <xsl:param name="type" select="''"/>
 
  <xsl:variable name="target" select="(ancestor::appendix|ancestor::article|ancestor::bibliography|ancestor::book|
                                       ancestor::chapter|ancestor::glossary|ancestor::part|ancestor::preface|
                                       ancestor::refentry|ancestor::reference|ancestor::refsect1|ancestor::refsect2|
                                       ancestor::refsect3|ancestor::refsection|ancestor::refsynopsisdiv|
                                       ancestor::sect1|ancestor::sect2|ancestor::sect3|ancestor::sect4|ancestor::sect5|
                                       ancestor::section|ancestor::setindex|ancestor::set|ancestor::sidebar|ancestor::mediaobject)[&scope;]"/>
 
  <xsl:variable name="id">
    <xsl:call-template name="object.id">
      <xsl:with-param name="object" select="$target[position() = last()]"/>
    </xsl:call-template>
  </xsl:variable>
 
  <fo:basic-link internal-destination="{$id}"
                 xsl:use-attribute-sets="index.page.number.properties">
    <fo:page-number-citation ref-id="{$id}"/>
  </fo:basic-link>
</xsl:template>
 
 
 
Bob Stayton
Sagehill Enterprises
bobs <at> sagehill.net
 
 
----- Original Message -----
To: "Bob Stayton" <bobs <at> sagehill.net>
Sent: Tuesday, September 30, 2008 4:07 PM
Subject: Re: [docbook-apps] Incorrect page numbers in index for indexterms within 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[ <at> align][1]/ <at> 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 <at> sagehill.net
>>
>>
>> ----- Original Message -----
>> From: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>> To: "Bob Stayton" <bobs <at> sagehill.net>
>> Cc: "Hudson, Scott" <Scott.Hudson <at> flatironssolutions.com>; "John Brown"
>> <johnbrown105 <at> hotmail.com>; <docbook-apps <at> 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 <at> sagehill.net
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>>>> To: "Scott Hudson" <scott.hudson <at> flatironssolutions.com>
>>>> Cc: "John Brown" <johnbrown105 <at> hotmail.com>;
>>>> <docbook-apps <at> 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[ <at> role='external-doc']">
>>>>>>          <xsl:apply-imports />
>>>>>>      </xsl:template>
>>>>>>
>>>>>>      <xsl:template match="chapter[ <at> 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=" <at> 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[ <at> 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 <at> lists.oasis-open.org
>>>>>>> For additional commands, e-mail:
>>>>>>> docbook-apps-help <at> lists.oasis-open.org
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>>>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
>>> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe <at> lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help <at> lists.oasis-open.org
>
>
>
Lillian Sullam | 1 Oct 23:59 2008

<link linkend> in XHTML output

Hello,

This is a two part question.

1. When I create chunked XHTML my <link linkend> tags do not seem to translate to XHTML. The ID are missing, and the links don't work. Is there a way to solve this without changing the way I link items in DocBook?

2. In every part of my chunked document the text reacts to any "hovering" of the mouse.  This should not happen, not all of the text is a link.

Here is a sample of the output XHTML code:

<div class="sect1" lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a id="Title 1"/>Title 1</h2>
</div>
</div>
</div>
<p>Some text here.</p> 1
<p>Some more text. A link <a class="link" href="Link_to_name">Link Name</a> 2 even more text.</p> 3
<div class="sect2" lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a id="d0e726"/>Title 2</h3> 4


1 Text reacts to "hover"
2 Text reacts to "hover"
3 Text no longer reacts to "hover"
4 Text reacts to "hover"

I have a feeling this has to do with the <a> tag being closed with a "/" instead of </a>, but why is this happening?

Lillian
John Brown | 2 Oct 00:23 2008
Picon

Re: double.sided Parameter Problem

Lily Galle <lily.galle <at> gmx.net> writes:

> 
> Dear all,
> 
<snip>

> With the “Xalan” Transformer I get the following error description if I set
the “double.sided”
> parameter to “1”: 
> 
<snip>

> java.lang.IllegalStateException: Flow 'xsl-region-body' does not map to the
region-body in
> page-master 'blank'.  FOP presently does not support this.

<snip>

If I recall correctly, you will get this error if you use FOP
and forget to set fop1.extensions = 1.
Dennison, Cheri | 2 Oct 00:42 2008
Picon

RE: <link linkend> in XHTML output

Lillian,

Regarding question #2, my team ran into this same problem last week and found it only occurred in Firefox 3.x (not in Firefox 2.x and not in IE—we didn’t check other browsers). Part of the problem is that Firefox 3.x expects *valid* XHTML (while earlier versions didn’t). And, I guess the XHTML output from DocBook (using Saxon 6.5.5, at least) is not valid XHTML with respect to closing anchor tags. Our quick fix was to switch to outputting HTML instead of XHTML. A co-worker who investigated this problem says there’s an add-on for Saxon that makes it generate XHTML, but I don’t know much beyond that.

 

HTH!

cheri

 

 

From: Lillian Sullam [mailto:lsullam <at> bruxton.com]
Sent: Wednesday, October 01, 2008 2:59 PM
To: docbook-apps <at> lists.oasis-open.org
Subject: [docbook-apps] <link linkend> in XHTML output

 

Hello,

This is a two part question.

1. When I create chunked XHTML my <link linkend> tags do not seem to translate to XHTML. The ID are missing, and the links don't work. Is there a way to solve this without changing the way I link items in DocBook?

2. In every part of my chunked document the text reacts to any "hovering" of the mouse.  This should not happen, not all of the text is a link.

Here is a sample of the output XHTML code:


 

<div class="sect1" lang="en">

         <div class="titlepage">
            <div>
               <div>

                  <h2 class="title" style="clear: both">

                     <a id="Title 1"/>Title 1</h2>

               </div>
            </div>
         </div>
         <p>Some text here.</p> 1

         <p>Some more text. A link <a class="link" href="Link_to_name">Link Name</a> 2 even more text.</p> 3

         <div class="sect2" lang="en">

            <div class="titlepage">
               <div>
                  <div>

                     <h3 class="title">
                        <a id="d0e726"/>Title 2</h3>
4

 

1 Text reacts to "hover"
2 Text reacts to "hover"
3 Text no longer reacts to "hover"
4 Text reacts to "hover"

I have a feeling this has to do with the <a> tag being closed with a "/" instead of </a>, but why is this happening?

Lillian

Bob Stayton | 2 Oct 01:22 2008
Picon

Re: <link linkend> in XHTML output

Hi,
Could you provide the XML input that generated that XHTML output?  And could you indicate which version of the stylesheet you are using and what XSLT processor?
 
Bob Stayton
Sagehill Enterprises
bobs <at> sagehill.net
 
 
----- Original Message -----
Sent: Wednesday, October 01, 2008 2:59 PM
Subject: [docbook-apps] <link linkend> in XHTML output

Hello,

This is a two part question.

1. When I create chunked XHTML my <link linkend> tags do not seem to translate to XHTML. The ID are missing, and the links don't work. Is there a way to solve this without changing the way I link items in DocBook?

2. In every part of my chunked document the text reacts to any "hovering" of the mouse.  This should not happen, not all of the text is a link.

Here is a sample of the output XHTML code:

<div class="sect1" lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a id="Title 1"/>Title 1</h2>
</div>
</div>
</div>
<p>Some text here.</p> 1
<p>Some more text. A link <a class="link" href="Link_to_name">Link Name</a> 2 even more text.</p> 3
<div class="sect2" lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a id="d0e726"/>Title 2</h3> 4


1 Text reacts to "hover"
2 Text reacts to "hover"
3 Text no longer reacts to "hover"
4 Text reacts to "hover"

I have a feeling this has to do with the <a> tag being closed with a "/" instead of </a>, but why is this happening?

Lillian
Andy Smith | 2 Oct 07:49 2008
Picon

Re: <link linkend> in XHTML output

2008/10/1 Lillian Sullam <lsullam <at> bruxton.com>:
> 2. In every part of my chunked document the text reacts to any "hovering" of
> the mouse.  This should not happen, not all of the text is a link.
[...]
> I have a feeling this has to do with the <a> tag being closed with a "/"
> instead of </a>, but why is this happening?

I think you're right, and you'll see the behaviour you describe if
your browser is interpreting the file as plain HTML rather than XHTML.
In plain HTML the </a> closing tag is mandatory, and I guess the
browser is treating the <a.../> as an opening tag (and acting as if
there's a closing tag later in the document) rather than an empty
element.

This appears to be fixed, in Mozilla at least, if you set up your web
server to serve XHTML files with the content type
application/xhtml+xml instead of text/html (or, if you're loading
straight from disk without a web server, try naming the files with
.xhtml extensions instead of .html). However this might not fix the
problem in all browsers and causes problems in some browsers, so if
you're thinking of setting up a web server like this have a look at:

http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html

and maybe also look for newer articles, since that one's from 2003 and
predates Internet Explorer 7 among other browsers.

If you use the stylesheets' HTML rather than XHTML output I think
you'll get closing tags and results that will generally be OK with the
text/html content type.

Or, if you're only worried about the mouse hover behaviour, you can
change your CSS. I guess you have a CSS rule with a selector including
"a:hover" and maybe also "a:active". If you change that to
":link:hover" or "a:link:hover" (and ":link:active" etc) it won't
affect <a> elements that aren't links, like the anchors here. This
might be enough, but there could be other consequences of the browser
treating XHTML as HTML. These <a> elements will still act as if they
cover text they're not meant to, and similar things might be happening
elsewhere, so you might find that CSS rules or JavaScript DOM access
don't work as expected.

Hope this helps,

Andy
Michael(tm) Smith | 2 Oct 09:20 2008
Picon

Re: <link linkend> in XHTML output

Andy Smith <andy.docbook <at> zambezi.org.uk>, 2008-10-02 06:49 +0100:

> 2008/10/1 Lillian Sullam <lsullam <at> bruxton.com>:
> > 2. In every part of my chunked document the text reacts to any "hovering" of
> > the mouse.  This should not happen, not all of the text is a link.
> [...]
> > I have a feeling this has to do with the <a> tag being closed with a "/"
> > instead of </a>, but why is this happening?
> 
> I think you're right, and you'll see the behaviour you describe if
> your browser is interpreting the file as plain HTML rather than XHTML.
> In plain HTML the </a> closing tag is mandatory, and I guess the
> browser is treating the <a.../> as an opening tag (and acting as if
> there's a closing tag later in the document) rather than an empty
> element.

Yep, because browsers don't parse text/html content as XML -- they
parse it as HTML, and in the HTML syntax that browsers support,
<a.../> means the same thing as <a...> (the HTML parsers in
browsers pay no attention to that slash).

That's just one of several reasons why it's not a good idea to
serve XSLT-generated output <at> method=xml content as text/html.

[...]
> If you use the stylesheets' HTML rather than XHTML output I think
> you'll get closing tags and results that will generally be OK with the
> text/html content type.

I think that's the best advice in general. For most cases, there
is zero harm in generating HTML content from XSLT using
output <at> method=html and much good in that it will prevent the
<a.../> problem, and others too.

  --Mike

--

-- 
Michael(tm) Smith
http://people.w3.org/mike/

Gmane