Bug 580751

Summary: Fails to build when a section in an appendix links to a term with and index entry
Product: [Community] Publican Reporter: Josh <joshkayse>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 1.6CC: jfearn, mmcallis, publican-list, r.landmann
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: publican-1.6.3-0.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-17 14:56:41 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
The test.fo with the duplicate IDs. none

Description Josh 2010-04-08 19:26:33 EDT
Created attachment 405426 [details]
The test.fo with the duplicate IDs.

Description of problem:
If you have a variable list with a term as an entry and the term has an index entry the FOP fails to complete with error: org.apache.fop.fo.ValidationException: file:/path/to/book/test/tmp/en-US/xml/test.fo:119:304: Property id "id562930" previously used; id values must be unique in document.

Version-Release number of selected component (if applicable):
publican-1.6.2-0.fc12.noarch

How reproducible:
Always

Steps to Reproduce:
1. publican create --type=book --name=test
2. add 
<variablelist>
<varlistentry>
<term id="test">
<indexterm><primary>primary</primary><secondary>secondary</secondary></indexterm>
term
</term>
<listitem><para>para</para></listitem>
</varlistentry>
</variablelist>
<para>A link <xref linkend="test"/></para>

to Chapter.xml
3. publican build --langs=en-US --format=pdf
  
Actual results:
org.apache.fop.fo.ValidationException: file:/path/to/book/test/tmp/en-US/xml/test.fo:105:278: Property id "id508178" previously used; id values must be unique in document.
        at org.apache.fop.fo.FObj.checkId(FObj.java:176)
        at org.apache.fop.fo.FObj.startOfNode(FObj.java:156)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:295)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:163)
        at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:208)
        at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:281)
        at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.comment(ToXMLSAXHandler.java:406)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.comment(AbstractSAXParser.java:670)
        at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.comment(XIncludeHandler.java:817)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:454)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:810)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:740)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:110)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1208)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:525)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:641)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:712)
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:317)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:214)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
        at org.apache.fop.cli.Main.startFOP(Main.java:166)
        at org.apache.fop.cli.Main.main(Main.java:196)
        Finished pdf


Expected results:
Successfully built pdf with a link to that term.


Additional info:
I have not tested whether it is specific to terms or affects other entries.
Removing either the xref or the indexterm allows the document to be built.

I've attached the produced test.fo
Comment 1 Jeff Fearn 2010-04-08 20:34:44 EDT
If you xref to an element without an XRefLabel it uses the content of that element as it's content, in this case that includes the indexterm, which has already been given a default ID.

Extra fun is added since we don't support XRefLabel in publican because of translation issues [1].

I'm guessing we will need to override the xref code so it doesn't copy indexterms when creating the text, not sure how long this will take.

You could probably work around it by moving the indexterm on to the listitem until we get a proper fix.

[1] http://jfearn.fedorapeople.org/en-US/Publican/1.5/html/Users_Guide/appe-Users_Guide-Disallowed_elements_and_attributes.html#sect-Users_Guide-Disallowed_elements_and_attributes-Disallowed_attributes
Comment 2 Jeff Fearn 2010-04-08 20:41:46 EDT
Here is another work around

<variablelist>
<varlistentry>
<term>
<indexterm id="test"><primary>term</primary><secondary>secondary</secondary></indexterm>
term
</term>
<listitem><para>para</para></listitem>
</varlistentry>
</variablelist>
<para>A link <xref linkend="test"/></para>

And you all wonder why I'm crazy.
Comment 3 Josh 2010-04-08 20:54:20 EDT
(In reply to comment #2)
> Here is another work around
> 
> <variablelist>
> <varlistentry>
> <term>
> <indexterm
> id="test"><primary>term</primary><secondary>secondary</secondary></indexterm>
> term
> </term>
> <listitem><para>para</para></listitem>
> </varlistentry>
> </variablelist>
> <para>A link <xref linkend="test"/></para>
> 
> And you all wonder why I'm crazy.    

confirmed, that works for us.  great job.

PS: making my own brand, I'm surprised you're as sane as you are...
Comment 4 Jeff Fearn 2010-05-10 08:48:36 EDT
I believe this is a bug in the upstream FO XSL.

Had to add ID to <xsl:template match="varlistentry/term">

Had to override:

<xsl:template match="varlistentry/term" mode="xref-to">
<xsl:template match="indexterm" mode="xref-to">
<xsl:template match="primary|secondary|tertiary" mode="xref-to">
Comment 5 Ruediger Landmann 2010-05-11 00:54:30 EDT
Verified that the code sample in the original report builds fine in PDF in 1.6.2.t169
Comment 6 Fedora Update System 2010-05-13 18:20:26 EDT
publican-1.6.3-0.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc13
Comment 7 Fedora Update System 2010-05-13 18:21:45 EDT
publican-1.6.3-0.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc12
Comment 8 Fedora Update System 2010-05-15 16:36:05 EDT
publican-1.6.3-0.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update publican'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc12
Comment 9 Fedora Update System 2010-05-15 16:45:21 EDT
publican-1.6.3-0.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update publican'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/publican-1.6.3-0.fc13
Comment 10 Fedora Update System 2010-05-17 14:55:18 EDT
publican-1.6.3-0.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 11 Fedora Update System 2010-05-17 14:59:11 EDT
publican-1.6.3-0.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.