DocBook transformation with Eclipse

26 views
Skip to first unread message

anatoly techtonik

unread,
Jan 14, 2010, 11:22:51 AM1/14/10
to vogella
Hello, Lars

I wonder how did you get default <xslt> transformation work with
DocBook for your tutorial at http://www.vogella.de/articles/DocBook/article.html
? I stripped examples to a bare minimum, but still no luck. The error
messages I am getting:

---cut------------------------
Buildfile: M:\p\lars\build.xml
depends:
build-html:
[xslt] Transforming into M:\p\lars\output
[xslt] Processing M:\p\lars\article.xml to M:\p\lars\output
\article.html
[xslt] Loading stylesheet M:\p\lars\docbook-xsl-1.72.0\html
\docbook.xsl
[xslt] : Error! Syntax error in '* or $generate.index != 0'.
[xslt] : Error! file:/M:/p/lars/docbook-xsl-1.72.0/html/
autotoc.xsl: line 372: Error parsing XPath expression '* or
$generate.index != 0'.
[xslt] : Error! file:/M:/p/lars/docbook-xsl-1.72.0/html/
autotoc.xsl: line 372: Required attribute 'test' is missing.
[xslt] : Error! Syntax error in '* or $generate.index != 0'.
[xslt] : Error! file:/M:/p/lars/docbook-xsl-1.72.0/html/
autotoc.xsl: line 491: Error parsing XPath expression '* or
$generate.index != 0'.
[xslt] : Error! file:/M:/p/lars/docbook-xsl-1.72.0/html/
autotoc.xsl: line 491: Required attribute 'test' is missing.
[xslt] : Fatal Error! Could not compile stylesheet
[xslt] Failed to process null

BUILD FAILED
M:\p\lars\build.xml:25: Fatal error during transformation

Total time: 2 seconds
---cut----------------------------------------------

The article.xml is taken from "3.2. Write your first DocBook
document", style.css is thrown out. build.xml is:

---cut------------------------------build.xml
<?xml version="1.0"?>
<!--
- Author: Lars Vogel
-->
<project name="docbook-src" default="build-html">

<description>
This Ant buildhtml.xml file is used to transform DocBook
XML to html output
</description>

<property name="docbook.xsl.dir" value="docbook-xsl-1.72.0" />
<property name="doc.dir" value="output" />
<property name="html.stylesheet" value="${docbook.xsl.dir}/html/
docbook.xsl" />


<target name="clean" description="Cleans up generated files.">
<delete dir="${doc.dir}" />
</target>

<target name="depends">
<mkdir dir="${doc.dir}" />
</target>

<target name="build-html" depends="depends" description="Generates
HTML files from DocBook XML">
<xslt style="${html.stylesheet}" extension=".html" destdir="$
{doc.dir}">
<include name="**/*book.xml" />
<include name="**/*article.xml" />
</xslt>
</target>

</project>
---cut------------------------------build.xml

Eclipse Java EE IDE for Web Developers.
Build id: 20090920-1017

Created empty Project. Opened build.xml and from context menu Run As -
> Ant Build

P.S. You may want to add id's to HTML elements in your generated
tutorials for easy references to chapters. Look at Trac wiki pages -
http://trac.edgewall.org/ notice paragraph sign when you hover a
title.

--
WBR,
anatoly t.

Lars Vogel

unread,
Jan 14, 2010, 1:31:21 PM1/14/10
to vog...@googlegroups.com
Hi,

I'm currently very busy but I try to have a look within the next days.

Cheers, Lars

2010/1/14 anatoly techtonik <tech...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "vogella" group.
> To post to this group, send email to vog...@googlegroups.com.
> To unsubscribe from this group, send email to vogella+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/vogella?hl=en.
>
>
>
>

--
Lars
http://www.vogella.de - Tutorials about Java, Eclipse and Web programming
http://www.twitter.com/vogella - Lars on Twitter

anatoly techtonik

unread,
Jan 14, 2010, 6:33:40 PM1/14/10
to vogella
I'll be waiting. Thank you.

On Jan 14, 8:31 pm, Lars Vogel <lars.vo...@googlemail.com> wrote:
> Hi,
>
> I'm currently very busy but I try to have a look within the next days.
>
> Cheers, Lars
>

> 2010/1/14 anatoly techtonik <techto...@gmail.com>:


>
>
>
>
>
> > Hello, Lars
>
> > I wonder how did you get default <xslt> transformation work with

> > DocBook for your tutorial athttp://www.vogella.de/articles/DocBook/article.html

> >http://trac.edgewall.org/notice paragraph sign when you hover a


> > title.
>
> > --
> > WBR,
> > anatoly t.
>
> > --
> > You received this message because you are subscribed to the Google Groups "vogella" group.
> > To post to this group, send email to vog...@googlegroups.com.
> > To unsubscribe from this group, send email to vogella+u...@googlegroups.com.
> > For more options, visit this group athttp://groups.google.com/group/vogella?hl=en.
>
> --

> Larshttp://www.vogella.de- Tutorials about Java, Eclipse and Web programminghttp://www.twitter.com/vogella- Lars on Twitter

Lars Vogel

unread,
Jan 18, 2010, 3:29:10 PM1/18/10
to vog...@googlegroups.com
Hi Anatoly,

FYI: I have reproduced the error and I'm currently trying to solve it.

Cheers, Lars

2010/1/14 anatoly techtonik <tech...@gmail.com>:

Lars Vogel

unread,
Jan 18, 2010, 3:59:31 PM1/18/10
to vog...@googlegroups.com
Hi,

I believe I found the error. I try to update the article tonight. I
post to this group once the description is updated in
http://www.vogella.de/articles/DocBook/article.html

Best regards, Lars

2010/1/18 Lars Vogel <lars....@googlemail.com>:

Lars Vogel

unread,
Jan 18, 2010, 9:54:30 PM1/18/10
to vog...@googlegroups.com
Hi,

tutorial is now updated. http://www.vogella.de/articles/DocBook/article.html

Please let me know if it works now for you.

Cheers, Lars

anatoly techtonik

unread,
Jan 21, 2010, 10:21:39 AM1/21/10
to vogella
Hello,

The solution with external XSLT processor worked for me before. With
external tool it is not really "DocBook with Eclipse". =) I wondered
how to avoid downloading Xalan, because in my Eclipse Java EE IDE for
Web Developers it is already present as
plugins/org.apache.xalan_2.7.1.v200905122109.jar

BTW, how did you manage to compile your examples in the first time?

As for article, FO transformation requires classpath adjustments too.
I use ANT macros to avoid repeating the same <xslt... /> attributes
such as classpath.

<macrodef name="xslt-me">
<attribute name="in"/>
<attribute name="out"/>
<attribute name="style"/>
<sequential>
<xslt in="@{in}" out="@{out}" style="@{style}">
<xmlcatalog refid="DTDs"/>
<classpath>
<pathelement path="${xslt-classpath}"/>
<pathelement path="${xslt-highlight}"/>
</classpath>
</xslt>
</sequential>
</macrodef>

<xslt-me in='hrc-ref.docbook-merged' out='hrc-ref.fo'
style='fo-hrc-ref-temporary.xsl'/>


xslt-classpath and xslt-highlight are read from external properties
file. xslt-highlight is path to highlight engine .jar which is said to
be coloring programlistings for DocBook, but so far I couldn't manage
to make it work. If you can start it - it will be nice addition for
your articles that seem to be generated from DocBook. =)

http://xmlguru.cz/2006/07/docbook-syntax-highlighting

Cheers!
--
anatoly t.

Lars Vogel

unread,
Jan 21, 2010, 12:28:40 PM1/21/10
to vog...@googlegroups.com
Hi Anatoly,

you should also be able too include
org.apache.xalan_2.7.1.v200905122109.jar into your classpath and it
should work.

> BTW, how did you manage to compile your examples in the first time?

I don't know; at some point it seem to stop working and I had to
switch to xalan.

Thanks for the FO pointer; I need to update the section. I'm currently
not using PDF generation thats why I was to lasy to update this part.
;-)

If you make this syntax highlighting work (for HTML output), please
let me know. This is a feature request for vogella.de almost from the
start but I have not been able to make this work.

Cheers, Lars

2010/1/21 anatoly techtonik <tech...@gmail.com>:

anatoly techtonik

unread,
Jan 21, 2010, 4:53:56 PM1/21/10
to vogella
On Thu, Jan 21, 2010 at 7:28 PM, Lars Vogel <lars....@googlemail.com> wrote:
>
> you should also be able too include
> org.apache.xalan_2.7.1.v200905122109.jar into your classpath and it
> should work.

Unfortunately it complains:
java.lang.NoClassDefFoundError: org/apache/xml/serializer/ExtendedContentHandler
Seems like it needs a couple of additional files. In any case I would
like to avoid including version-specific files into build.xml, because
their version and placement varies for everyone. The only acceptable
solution could be if the classpath is expressed in installation
neutral way. To my regret even ${eclipse.home} doesn't work in all
cases.

> If you make this syntax highlighting work (for HTML output), please
> let me know. This is a feature request for vogella.de almost from the
> start but I have not been able to make this work.

If you don't mind against command line utilities - there is
http://colorer.sourceforge.net/ that can be used with some scripting
in the build post-processing step.

--
anatoly t.

Lars Vogel

unread,
Jan 22, 2010, 2:23:07 PM1/22/10
to vog...@googlegroups.com
Hi,

I guess I stick then with the downloaded xalan processor.

http://colorer.sourceforge.net/ looks cool but I believe this would
require manual steps and I really need to integrate this into the Ant
build script.

Best regards, Lars

Reply all
Reply to author
Forward
0 new messages