Re: XSL-FO to Word Conversion Tool

Hussein Shafie <[email protected]>
Newsgroups gmane.text.xml.xfc.general
Message-ID <[email protected]>
On 05/28/2013 01:30 PM, Uma Shankar M wrote:
>
> I am Uma Shankar, XML Engineer at Juniper Networks’ Document Engineering
> division. I am trying to build a tool for our organization which
> converts out XML documents into Word format. Today, we are generating
> PDFs using XSL-FO output format from our XML documents. When I came
> across your website, I tried the evaluation version of the *XMLMind XSL
> Utility* to convert our XSL-FO output into Word documents. During the
> conversion I have got few queries:
>
> 1.The Page Numbers not generated at all in the table of contents
> section. I am guessing that the <fo:page-number-citation> element is not
> handled properly.

This cannot be done outside MS Word. Please refer to this FAQ:

---
I use the page-number-citation object to print the number of pages in my 
document, but the displayed value is always 0 when I load the document 
in MS-Word. How can I get the correct value?
---
http://www.xmlmind.com/foconverter/faq.html#fields



>
> 2.Are the SVG images not supported by this tool? Although the images are
> available, the SVG images are not rendered in the output.

Yes, but your XSL-FO file contains incorrect image URLs. For example, 
what follows is not a correct URL:

url(//cmsxml/default/main/supplemental/STAGING/images/note-icon.svg)

Please refer to this FAQ (also applies to SVG):

---
My .fo file contains a fo:external-graphic element which points to an 
existing JPEG file, but this image is not showing in the document 
generated by XFC. Are there known bugs related to image support in XFC?
---

http://www.xmlmind.com/foconverter/faq.html#image_not_showing




>
> 3.I found incomplete lines for Header and Footers. The length line is
> expected to be same as page width. However, the length is less than page
> width.
>
> 4.Code elements indented to right. Some elements (fo:block and
> fo:inline) inside a table are indented toward right and are unreadable.
> (Page xvi: Column 3 in Rows 3 and 6)
>
> 5.Bullets appearing as boxes. The hexa-decimal character (&#x2022;)
> representing bullet is rendered as boxes. (Page 2: In front of every
> title, a box is seen)
>
> 6.Unexpected indentation between inline images and running text in
> admonition elements. (Page 4: Space between “NOTE:” and “IEEE 802.3aa
> class..”)


I'm sorry but I cannot spend too much time looking at the 2.5Mb XSL-FO 
file you sent me.

It seems that you need to adjust the program (an XSLT stylesheet?) which 
generates the XSL-FO to make it generate slightly different, generally 
simpler, XSL-FO.

Example 1: Generating what follows for code blocks is *much* *much* too 
complicated. A *single* fo:block having white-space="pre" suffices.

---
<fo:block>
   <fo:block line-height="11pt" space-after="6pt"
             space-before="6pt" text-align="left">
     <fo:block-container writing-mode="lr-tb">
       <fo:wrapper start-indent="1.5in">
         <fo:block font-family="Arial" font-size="7.5pt"
         line-height="10pt" margin-left="2em"
         text-align="start"
         text-indent="-1em">[edit]</fo:block>
       </fo:wrapper>
     </fo:block-container>
     <fo:block-container writing-mode="lr-tb">
       <fo:wrapper start-indent="1.5in">
         <fo:block font-family="Arial" font-size="7.5pt"
         line-height="10pt" margin-left="2em"
         text-align="start"
         text-indent="-1em">routing-options { </fo:block>
       </fo:wrapper>
     </fo:block-container>

     ... MANY SIMILAR fo:block-container HERE ...

     <fo:block-container writing-mode="lr-tb">
       <fo:wrapper start-indent="1.5in">
         <fo:block font-family="Arial" font-size="7.5pt"
         line-height="10pt" margin-left="3em"
         text-align="start" text-indent="-1em">} </fo:block>
       </fo:wrapper>
     </fo:block-container>
     <fo:block-container writing-mode="lr-tb">
       <fo:wrapper start-indent="1.5in">
         <fo:block font-family="Arial" font-size="7.5pt"
         line-height="10pt" margin-left="2em"
         text-align="start" text-indent="-1em">}</fo:block>
       </fo:wrapper>
     </fo:block-container>
   </fo:block>
</fo:block>
---

Example 2:  font-family="Symbol,ZapfDingbats" is fine for PDF output. 
However, on Windows, hence for MS Word, font Symbol has no glyph for 
character &#x2022; (there is indeed a bullet, but it's not character 
&#x2022;, it's &#183;).

---
       <fo:list-item-label end-indent="label-end()">
         <fo:block space-after="0.1cm">
           <fo:block color="black"
           font-family="Symbol,ZapfDingbats"
           font-size="6pt">•</fo:block>
         </fo:block>
       </fo:list-item-label>
---






>
> I have read your documentation that the words are not properly converted
> in evaluation version and hence, I can justify the spelling mistakes in
> Word output. Are the above mentioned issues also expected in evaluation
> version? I am attaching the FO output (book-arial1), the converted Word
> output (test4bookarial.docx) and PDF generated with this FO
> (book-arial.pdf) in this mail, for your reference. If these issues are
> expected in evaluation version, can you try the conversion of the
> attached FO with real version and see if these issues are fixed?


See attached book-arial1.docx.

As explained above, I cannot spend too much time modifying your large 
XSL-FO file to fix all the issues you have reported.

* I've removed font-family="Symbol,ZapfDingbats" from just a couple of 
lists.

* I've replaced 
url(//cmsxml/default/main/supplemental/STAGING/images/XXX.YYY) by 
url(images/XXX.YY) everywhere in your XSL-FO

You didn't send us any of the images referenced in your document. 
Therefore all the images are missing from the .docx. (Except 
juniper_logo.svg which I got from Wikimedia.org; just to prove that SVG 
works fine when the URL is correct).




>
> We wanted to run this utility using Java APIs. Can you confirm if the
> output obtained from the standalone installation will be identical (in
> all aspects) with the output generated from APIs?

Yes.




>
> If the utility can properly transform my XSL-FO output into a valid Word
> output format using Java APIs, then I am interested in purchasing the
> license and use it for my FO àWord conversion.
>

Yes, our tool can properly convert documents similar to the one you sent 
us. (We and our customers process similar documents all the time.)

However, unless you accept to slightly change the XSL-FO you generate in 
order to adapt it to our tool (while keeping it compatible with RenderX 
XEP and other XSL-FO processors), you won't get the professional looking 
results you expect.

* This FAQ contains a couple of very useful tips to achieve this goal:

---
I cannot get the results that I want. Can you help me tweak my XSLT 
stylesheet?
---

http://www.xmlmind.com/foconverter/faq.html#xsl_consulting

* You'll have to use some of our extensions to solve problems such as 
leaders in the Table of Contents.

See 
http://www.xmlmind.com/foconverter/_distrib/doc/user/implementation.html#leaders





---
PS: FYI, Apache FOP cannot convert the XSL-FO you sent us. It stops with 
an 'The flow-name "blank-body" on fo:static-content could not be mapped 
to a region-name in the layout-master-set' *validation* error. This 
seems to indicate that you have tested your XSL-FO against a single 
XSL-FO processor (RenderX XEP?).


--
XMLmind FO Converter Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xfc-support
book-arial1.docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document, 412.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.