XMLmind   
    Home    Products    Services    Resources
Products
 
XSL-FO Converter
    Features
    Personal Edition
    Professional Edition
    Download Personal Edition
    Buy Professional Edition
    Upgrade Professional Edition
    Documentation
    Support
        FAQ
        Mailing Lists
    XSL Utitility
Qizx/db XML Database
XML Editor

 

Site Map
Contact

FAQ

This page provides answers to the most frequently asked questions regarding XMLmind XSL-FO Converter (XFC for short) and its graphical user interface (XSL Utility).

Questions regarding the evaluation of XFC

End user questions

  • 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?

Questions regarding the evaluation of XFC

Q: Do you have a trial version of XFC Professional Edition?

A: No. XFC Personal Edition can be used to evaluate XFC is terms of speed and quality of output.

Note that XSL Utility prints on its console the time spent in each step of the XML processing pipeline. Example:

Compiling stylesheet "/usr/local/src/xfc-40/xslu/config/docbook/xsl/fo/docbook.xsl"...
Stylesheet compiled in 1.183s.
Transforming input "/home/hussein/src/xxe/docsrc/xvalid/xvalid.xml"...
Input transformed in 1.264s.
Processing FO "/home/hussein/src/xxe/docsrc/xvalid/xfcxslu63532.tmp"...
FO processed in 0.359s.
Conversion completed.

Q: I have tested XFC using Personal Edition. But now, I need to estimate how long it will take me to integrate XFC in my application. How can I do that?

A: XFC is very easy to integrate in any application. The following code converts an XSL-FO file to an RTF file:

import com.xmlmind.fo.converter.Driver;

public class Sample1 {
    public static void main(String[] args) throws Exception {
        if (args.length != 2) {
            System.err.println("usage: java Sample1 fo_file rtf_file");
            System.exit(1);
        }

        Driver xfc = new Driver();
        xfc.setProperty("outputFormat", "rtf");
        xfc.setInput(args[0]);
        xfc.setOutput(args[1]);
        xfc.convert();
    }
}

The following code converts an XML file to an RTF file, using any JAXP-compliant XSLT engine:

import java.io.File;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.Templates;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import com.xmlmind.fo.converter.Driver;

public class Sample2 {
    public static void main(String[] args) throws Exception {
        if (args.length != 3) {
            System.err.println("usage: java Sample2 xslt_stylesheet" + 
                               " xml_file rtf_file");
            System.exit(1);
        }

        TransformerFactory factory = TransformerFactory.newInstance();
        Templates compiledStylesheet = 
            factory.newTemplates(new StreamSource(new File(args[0])));

        Transformer transformer = compiledStylesheet.newTransformer();
        File xmlFile = new File(args[1]);
        File foFile = File.createTempFile("sample2_", ".fo");
        transformer.transform(new StreamSource(xmlFile),
                              new StreamResult(foFile));

        Driver xfc = new Driver();
        xfc.setProperty("outputFormat", "rtf");
        xfc.setProperty("baseURL", 
                        xmlFile.getParentFile().toURL().toExternalForm());
        xfc.setInput(foFile.getPath());
        xfc.setOutput(args[2]);
        xfc.convert();

        foFile.delete();
    }
}

Refer to the API documentation [Java] [.NET] for additional information.

Q: This XSL technology seems elegant but also terribly complex. What can you say to convince me to take the time to learn it?

A: This technology is not that complex. And it is certainly less tedious to learn than PDF, RTF, WML, OpenOffice, etc.

XSL-FO is conceptually simple. Basically Formatting Objects are just nested blocks and text containers with attached style properties. XSL-FO is not harder to learn than HTML+CSS.

XSLT is clearly more challenging to learn than XSL-FO.

Alternatively you can use XML Query (AKA XQuery), which is, in our opinion, easier to learn and to use than XSLT. We recommend using one of these two XML query processors: qizx/open or Saxon 8+.

Also note that, for some applications, directly generating XSL-FOs is the simplest and most efficient solution.

Q: XFC is an XSL-FO processor written in JavaTM and, by experience, I know that XML processing in JavaTM is slow to the point of being unusable. Is XFC really usable in a production environment?

A: Yes, if you do not implement the XML processing pipeline naively and if you carefully choose your software components:

  • Carefully choose your XML parser. For example, use XP for JAXP, Crimson (included in Java SDK 1.4+) or Xerces 2.x (included in Java SDK 1.5+) instead of Xerces 1.x.
  • Use a URI resolver and properly configured XML catalogs to prevent downloading the DTDs from the Web.
  • Some XML parsers are validating parsers (Crimson and Xerces but not XP). Make sure to turn validation off.
  • Carefully choose your XSLT processor or your XQuery processor. For example, use Saxon instead of Xalan (included in Java SDK 1.4+).
  • Create a compiled representation of the XSLT style sheet (that is, invoke TransformerFactory.newTemplates(stylesheet)) and use it each time you need to transform the XML input to the XSL-FO output.

Q: Now that all major office automation formats are publicly available, well-documented, XML-based standards, why would I need a software component such as XFC?

A: Nowadays, all major office automation formats are based on very low-level XML vocabularies expressing in great details how to layout some text on a page.

WorprocessingML example (paragraph containing the following text "Some unnamed character level styles: underline, italic, bold."):

<w:p>
  <w:r>
    <w:t>Some unnamed character level styles: </w:t>
  </w:r>
  <w:r>
    <w:rPr>
      <w:u w:val="single"/>
    </w:rPr>
    <w:t>underline</w:t>
  </w:r>
  <w:r>
    <w:t>, </w:t>
  </w:r>
  <w:r>
    <w:rPr>
      <w:i/>
      <w:i-cs/>
    </w:rPr>
    <w:t>italic</w:t>
  </w:r>
  <w:r>
    <w:t>, </w:t>
  </w:r>
  <w:r>
    <w:rPr>
      <w:b/>
    </w:rPr>
    <w:t>bold</w:t>
  </w:r>
  <w:r>
    <w:t>.</w:t>
  </w:r>
</w:p>

The documentation of these formats is always very large and often obscure. Therefore, learning these formats is uninteresting and takes a long time.

This being said, now let's compare the different methods which may be used to automatically generate documents in office automation formats:

MethodLearning CurveEasy to MaintainSpeedQuality of OutputMultiple Output FormatsNotes
Generate the markup using println().0 star
(You need to learn the output format.)
0 star3 stars0 star
(This method makes it extremely tedious to generate something that looks good.)
No
Generate the markup using an XSLT style sheet.0 star
(You need to learn the output format.)
2 stars2 stars
(No XSL-FO processor.)
0 star
(This method makes it tedious to generate something that looks good because office automation formats are very low-level compared to XSL-FO.)
No
  1. Use the word processor to generate a template.
  2. Insert variables (e.g. @My_Variable@) in this template using a text editor.
  3. The first two steps are done once for all. Generating a document simply means copying the template after substituting the variables with their values.
3 stars3 stars3 stars3 starsNoA simple solution for simple problems. Very limited. For example, you cannot add rows to a table contained in the document template.
Use an SDK specialized in generating the office automation format.2 stars
(You still need to learn the SDK.)
0 star
(You'll have to write a lot of code.)
3 stars0 star
(This method makes it tedious to generate something that looks good.)
No
  1. Use an XSLT style sheet to generate XSL-FO.
  2. Convert the XSL-FO to the office automation format using XMLmind XSL-FO Converter.
0 star
(but it's a good investment!)
3 stars0 star3 starsYes

End user questions

Q: 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?

A: Page references are implemented with RTF fields. The values of these fields are not automatically updated when loading a document in MS-Word. The easiest way to update all field values is to force a repagination of the document, for instance by switching to the Page Layout view. This will work fine for fields in the body of the document, but not for those in the headers/footers. To update fields in the headers or footers of a document, proceed as follows:

  1. Switch to the Page Layout view.
  2. Double-click on an odd page header/footer outline.
  3. Type Ctrl-A (Select all) and F9 (Update fields).
  4. Double-click on an even page header/footer outline and repeat step #3.
  5. If applicable, double-click on the title page header/footer outline and repeat step #3.

 


© 2003-2008 Pixware. Updated 2008/2/22 using Qizx/open.

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Acrobat and PostScript are trademarks of Adobe Systems Incorporated.