• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1353
  • Last Modified:

How to view XSL-FO document's output in ALTOVA XML SPY 2008 ?


I have the following XSL-FO document. Can you please let me know step-by-step how can i view the output of this document ?


<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

  <fo:simple-page-master master-name="MyPage">

<fo:page-sequence master-reference="MyPage">
  <fo:flow flow-name="xsl-region-body">
    <fo:block>Hello World !</fo:block>


How to  save the above document - with .XML extension or something else ? Appreciate your time and patience !!


Open in new window

  • 4
1 Solution
To start with your last question: basically, it does not really matter, but most people use *.fo as extension for XSL-FO documents. But any XSL-FO document is first and foremost also an XML document, so using *.xml is fine too. If you want to serve it over the internet and you want the people to view it as XML text in their browser, you should make sure to set the correct HTTP headers (which you can do in the configuration screens of IIS or mime-types of Apache).

A little remark about your XSL-FO document: consider using UTF-8 as an encoding as much as you can, unless you have compelling reasons to use an older encoding. The Latin-1 encoding (ISO-8859-1) is a very limited encoding which means that sooner or later you have to write many characters as xml entities, which can be annoying, error prone and confusing all at once.

Step-by-step is on the way....

-- Abel --
First the prerequisites. To use XSL-FO, you need an XSL-FO processor, that takes your XSL-FO input and creates PDF (or some other graphical format) for you. The only open source processor available is Apache FOP, which is currently under very active development. I recommend the FOP mailing list as a good source for getting acquainted with FOP and XSL-FO. In addition, the XSL list at http://www.mulberrytech.com/xsl/xsl-list/ is excellent for general questions about XSL-FO and/or XSLT. It is a high-quality list where several original contributors of the W3C spec are still active.

Step 1: Download FOP binary from http://www.apache.org/dyn/closer.cgi/xmlgraphics/fop. From one of the mirrors choose a file with the name "fop-0.94-bin-jdk1.4.zip" or "fop-current-bin-jdk1.4.zip".

Step 2: Extract the contents of the FOP ZIP to a location of your liking.

Step 3: make sure you have the right JDK (should be 1.4 or higher). You can test this (if Java is on your path) by typing "java -version" (without quotes) at the command prompt.

Step 4: test your fop installation. Go to a command prompt and go to the directory from Step 2. Type "fop" + Enter. You should see a usage guide, with at the top "fop 0.94" and at the bottom an error about "No input file specified". If not, please tell me your error and I'll try to help you.

Step 5: Open Altova 2008 and go to Tools > Opteions > XSL. Under "Please enter path to XSL-FO transformation engine" type or select the path to fop.bat (from Step 2 above) and Click OK.

Now you are done with the preliminaries and the fun can start ;)

-- Abel --
Now for the final bits. If you want to run your own example, you can do the following:

1. Open your file (or create a new XML file fo XSL file)
2. Hit Ctrl-F10 (or XSL/XQuery > XSL-FO Transformation)
3. Leave the default options, Click OK
4. Select a place for the temporary output pdf and click Save

You will now see an error about your missing elements (notably xsl:region-body). To have a successful transformation into a PDF, I suggest you try one of the examples that were delivered with FOP. You can find them in the <FOP_INSTALL>\examples\fo directory.

A good start is the file in <FOP_INSTALL>\examples\fo directory\basic\normal.fo. If you open it in XML Spy and you hit Ctrl-F10, you will see a message "Standard error" which you can ignore (thanks to Altova) and in a new window you will see the content of the PDF (if you have Adobe Acrobat Reader installed).

Hope this helps,

-- Abel --

PS: a rather elaborate "first example" with some explanations is here: http://www.dpawson.co.uk/xsl/sect3/N8565.html

I agree with that solvation ;)
Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now