You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Dominic Jacobssen <do...@gmail.com> on 2010/06/28 13:53:47 UTC

Convert XHTML to ODF using Xalan-J only yields first paragraph.

Hi all.

(Apologies if anyone gets this twice; I didn't realise the first time
that I probably needed to be subscribed to the list; the blurb at
http://xml.apache.org/xalan-j/contact_us.html wasn't clear on this
point).

Anyway, I'm trying to convert XHTML to ODF using Xalan-J and the XSLT
stylesheets from the xhtml2odt project here:

   http://gitorious.org/xhtml2odt

This is my first foray into using XSLT, so I've probably messed up
somewhere, but I'm not sure where, and I was wondering if anyone more
experienced in XSLT and/or Xalan could prod me in the right direction.

Using the input file "in.html" (attached), I can convert to an ODF
node fragment with the *same* stylesheets and the command line
"xsltproc" tool just fine:

   xsltproc --output out.xml ~/SCM/xhtml2odt/xsl/xhtml2odt.xsl in.html

generates the file "out.xml" (attached).

The Python script "xhtml2odt.py" from the xhtml2odt project also works
(although it inserts the output into an ODT document, using a
template, instead of just yielding ODF fragments).

However, using the Java file "DemonstrateQuestion.java" (attached), I
get the output shown in "xalanj.xml" (attached). It's a lot more
verbose than the xsltproc output, but importantly, I only get the
first paragraph converted. In other words, stripping out the xmlns
noise, I only get:

    <text:p text:style-name="Text_20_body">I am the first paragraph.</text:p>

The Java program is being run with the JVM directive:

   -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

I think I must be using Xalan incorrectly, but it's all getting a bit confusing.

If anyone could afford any help on this, I'd be ever so grateful.

Cheers,

D