Error in DITA to PDF

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Error in DITA to PDF

Post by H_Too_Oh » Tue May 22, 2012 12:10 am

I've got a new bookmap that's been building fine, and something I've added to it or the topics in it is now giving this error when generating XEP PDF:

Code: Select all

transform.fo2pdf.xep:
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
It looks like something in the DITA-OT files but I've got several other bookmaps that don't show the error when generating PDFs, so it must be something I've added to this particular bookmap or topics. Tables are such a usual suspect that I tried deleting the one it has, but no change. Nothing shows when I validate, all is good.

I find a number of places with "start-indent" in DITA-OT files but --? Can you explain what it means by these attribute types Length and Word, and where I might chase down what's wrong?

Thanks,

Radu
Posts: 6380
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error in DITA to PDF

Post by Radu » Tue May 22, 2012 9:03 am

Hi,

Those are warnings, does the transformation break because of those?
There are on the XEP users list threads discussing this issue:

http://services.renderx.com/lists/xep-support/1829.html

The idea is that the DITA OT when it publishes a DITA Map to PDF will create an intermediary XSL-FO file on which Apache FOP or XEP are used to produce the PDF output.

In order to see that temporary file you can edit the DITA Map to PDF transformation scenario and set the parameter clean.temp to no and retain.topic.fo to yes.
Then after the transformation finishes, in the temporary files directory you will see a file called topic.fo which is the XSL-FO file on which XEP is applied.
That file probably contains some attributes start-indent which have certain values which cannot be processed by XEP.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Tue May 22, 2012 12:56 pm

Thanks for the reply,

It was breaking the build most definitely, but after tweaking things I changed the "clean output" argument to yes and that seems to have it building again.

I looked through the topic.fo file and it certainly does contain start-indent many times throughout the whole thing, but I couldn't see any clues about what was wrong, and nothing about "Length" or "Word" showed up.

It's now giving a mysterious error about an image also:
transform.fo2pdf.xep:
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
[java] EXCEPTION: Failed to create image file:/spf-doc/doc_notes/images_doc_notes/config_transformation_wrong.png of type null
[java] WARNING: Bad attribute start-indent: Cannot add type Length to type Word
It gave me this error about another image, so I replaced the image, giving the .png a different name, and that resolved the error. Then this one appeared, and I've recreated and renamed the image, and reinserted it, but it's looking for the old image name still. A search of the DITA XML source files shows no reference to the old image name anymore, in fact nothing on the entire computer does (The Mac does file content search as well as file name), since I threw it away.

I turned off the temp argument so it would not keep that file, thinking it might have retained the reference to the old file there, and then also now toggled on the "clean output" setting, but still getting the error, plus a long line of the ones about start-indent.

If I toss out almost all of the topics, I still get the start-indent error, but only once. I'm trying to narrow it down more, luckily this bookmap has relatively few topics.

If I delete the topic that the error-related image is in, I still get that image error along with the others.

At least it's building now, so I guess I can ignore the warnings if I have to. It's good to know the process to check that topic.fo, and a little more about how it works.

Thanks again,

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Tue May 22, 2012 1:23 pm

Sorry I hadn't read this yet: http://services.renderx.com/lists/xep-support/1829.html

I'll investigate more. I only have one topic with a list nested in a list, and removing the topic didn't change the warnings. I'm thinking maybe codeblocks nested inside a list, I have lots of those. It explains more about the start-indent error anyway, so that should help.

I found that the image was in fact referenced in another place, it looks like the generic Mac text search doesn't find all text, when I searched the source files. I just double-checked by searching the same directory with Oxygen's "find in files" text search and it found the string in the image reference just fine.

That'll teach me to just use Oxygen as my text search, even for general use on the computer.

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Tue May 22, 2012 1:54 pm

Yes that was it. It doesn't like:

Code: Select all

  
<ol>
<li></li>
<li><codeblock></codeblock></li>
<li></li>
</ol>
The warnings all correspond to instances of that.

I can ask XEP, but offhand can you explain what he means by this?
As a workaround, I recommend using 'margin-left' for this case.
I don't understand how to apply that for example to the list/codeblock structures above.

I can leave it as is but I'd prefer to get rid of any warnings, especially that long list of them, since I'll be handing this off to someone else and it's one more thing I have to explain and looks scary. And I do want to use the codeblocks that way if I can.

Radu
Posts: 6380
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error in DITA to PDF

Post by Radu » Tue May 22, 2012 4:03 pm

Hi,

You are right, that particular DITA content generates a part of the XSL-FO file like:

Code: Select all

<fo:list-item-body start-indent="body-start()">
<fo:block><fo:block background-color="#f0f0f0" end-indent="6pt + from-parent(end-indent)" font-size="10pt" keep-with-previous.within-page="always" line-height="106%" linefeed-treatment="preserve" padding="6pt" space-after="0.6em" space-before="0.6em"
start-indent="6pt + from-parent(start-indent)" white-space-collapse="false" white-space-treatment="preserve" wrap-option="wrap"
line-height-shift-adjustment="disregard-shifts" font-family="Courier New, Courier"><fo:block></fo:block>
</fo:list-item-body>
Which contains something like start-indent="6pt + from-parent(start-indent)" which is probably the cause of the problem.

I will post a bug on the DITA OT Bugs list about this, maybe they can modify the XSLT stylesheets which generate the FO file to avoid this warning.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 6380
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error in DITA to PDF

Post by Radu » Tue May 22, 2012 4:14 pm

Hi,

Here is the bug I've posted:

https://github.com/dita-ot/dita-ot/issues/1280

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Tue May 22, 2012 4:47 pm

Okay, in the meantime I found this file that seems to control those attributes for the codeblocks:

/Applications/oxygen/frameworks/dita/DITA-OT/demo/fo/cfg/fo/attrs/pr-domain-attr.xsl

which had this in it:

Code: Select all

 <xsl:attribute name="start-indent">6pt + from-parent(start-indent)</xsl:attribute>
So I changed deleted the + from-parent(start-indent) part, and the error is gone. I had to play around with the number to get the indentation where I wanted it, here's what I ended up doing, here's mine now:

Code: Select all

 
<xsl:attribute-set name="codeblock" use-attribute-sets="pre">
<xsl:attribute name="keep-with-previous.within-page">always</xsl:attribute>
<xsl:attribute name="start-indent">28pt</xsl:attribute>
<xsl:attribute name="end-indent">6pt</xsl:attribute>
<xsl:attribute name="padding">6pt</xsl:attribute>
</xsl:attribute-set>
which replaces the existing one:

Code: Select all

<!-- 
<xsl:attribute-set name="codeblock" use-attribute-sets="pre">
<xsl:attribute name="keep-with-previous.within-page">always</xsl:attribute>
<xsl:attribute name="start-indent">6pt + from-parent(start-indent)</xsl:attribute>
<xsl:attribute name="end-indent">6pt + from-parent(end-indent)</xsl:attribute>
<xsl:attribute name="padding">6pt</xsl:attribute>
</xsl:attribute-set>
-->
Codeblock indentation is now in line with text at the left, which is fine, the only time it might be weird now is if I had codeblocks in a second-level list, which would be indented and the codeblock wouldn't be. Since I don't, however, this works fine.

Thanks again for the help,

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Sun Jun 03, 2012 8:46 pm

Hi,

I don't know if this is related to that bug but I've suddenly got more problems with Render X, this error is appearing:
transform.fo2pdf.xep.init:

transform.fo2pdf.xep:
[java] ERROR: Attribute 'end-indent' cannot have a value of "".
[java] Rendering failed: Invalid XSL FO source 'file:/spf-doc/spf-doc (trunk)/temp/topic.fo': 1 error found during validation
but 'end-indent' isn't always the attribute it lists, sometimes it's 'space-before', sometimes 'text-align", it changes.

I've narrowed it down to one chapter. If I remove those topics, it always makes the error go away, but if I try to narrow it down more than that it becomes weird. I removed the top four topics and that fixed it also, then narrowed it down to removing one topic and that fixed it-- but then it returned. It seems to jump around, in several senses. I rebuilt several topics from scratch, the ones that seemed to be causing it, but that didn't help. I can't see anything unusual about these topics, and there are no nested lists in them.

I've searched the topic.fo file in the temp directory but never find any blank values like end-indent="" (or whatever the error version is at the particular time), they all have something inside the quotation marks.

Other maps I have build fine, so it doesn't seem to be the DITA-OT settings, and most of this bookmap works also. I have a lot of images in this particular chapter, but I've removed them all and it didn't help, and I have images in other parts of the book also.

I wrote to XEP but if anyone here has any clues they'd be welcome.

Thanks,

Radu
Posts: 6380
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error in DITA to PDF

Post by Radu » Mon Jun 04, 2012 8:46 am

Hi,

XEP has a configuration file called something like xep.xml.
In it you can add properties which make it more robust when it comes to handling XSL-FO files:

http://services.renderx.com/lists/xep-support/6737.html

So adding this property to it:

Code: Select all

<option name="VALIDATE" value="false"/>
should instruct XEP to get over such problems.

But the real issue is probably a bug in the DITA OT which generates invalid XSL-FO output.
If you find the DITA content which generated the problem please update this post, maybe we can add this as a bug to the DITA OT bugs list and have it fixed in a future version.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

H_Too_Oh
Posts: 44
Joined: Tue Mar 13, 2012 5:01 pm

Re: Error in DITA to PDF

Post by H_Too_Oh » Mon Jun 04, 2012 11:20 am

Thanks Radu,

I had a response from XEP this morning that pointed me to that thread also, and adding that parameter solved the problem.

I tried everything to zero in on which content was generating it but it was a moving target, made no sense at all. One chapter seemed to be causing it, and I couldn't narrow it down any further than that. The same chapter added to a new empty bookmap would generate fine however, so even sending you that wouldn't tell you anything since alone, it works.

if I find out anymore I'll post again, thanks,

Post Reply