BlackVegetable
BlackVegetable

Reputation: 13064

XML (XSL) Error -- Converting HTML to PDF (Java)

I am nearly finished with a program to convert HTML to a PDF format. My issue is more specific than this program though. I have an XSL file that is giving me some grief when I try to use it with my program.

When using javax.xml.transform.Transformer.transform(source, result) I am getting the following warning and error messages due to my XSL styleSheet:

Compiler Warnings: Attribute 'leader-length' outside of element.
ERROR: 'Error(Unknown location): fo:list-item is not a valid child element of fo:block.'

The XSL file in question can be found here: http://webcoder.info/downloads/xhtml2fo.html

It is recommended by this tutorial: https://blogs.oracle.com/chrisf/entry/converting_html_to_pdf_using

Any assistance with what/where these error messages are coming from would be of great help! I am totally unfamiliar with XSL files.

Thank you so much.

EDIT: I suppose it is possible that something else is at fault. Using other XSL files, I get: "Document is empty (Something might be wrong with your XSLT stylesheet)" However, I am following the Oracle tutorial pretty much to the letter. Does he have a bug in his code? (Within the link above.)

EDIT2: I should have posted this in the first place: http://webcoder.info/downloads/xhtml2fo.xsl

If that link isn't working, I'll paste in the exact code here. Thanks!

EDIT3: This is some of the HTML I am trying to use as an example: http://docs.oracle.com/javase/1.4.2/docs/tooldocs/solaris/classpath.html

Upvotes: 0

Views: 2007

Answers (1)

Joop Eggen
Joop Eggen

Reputation: 109603

On the line before <fo:leader ... /> should not have that slash /.

Upvotes: 1

Related Questions