Solved

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

Posted on 2007-12-02
6
1,309 Views
Last Modified: 2013-11-18
Hi,

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 ?

Introduction.xml
=============

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

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

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

</fo:root>

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

Thanks

Open in new window

0
Comment
Question by:kishore_peddi
  • 4
6 Comments
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 20394296
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....

Cheers,
-- Abel --
0
 
LVL 39

Expert Comment

by:abel
ID: 20394365
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 ;)

Cheers,
-- Abel --
0
 
LVL 39

Expert Comment

by:abel
ID: 20394397
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,

Cheers,
-- Abel --

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

0
 
LVL 39

Expert Comment

by:abel
ID: 20623549
I agree with that solvation ;)
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20659502
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now