开发者

Docbook, Images, ANT

开发者 https://www.devze.com 2022-12-08 12:34 出处:网络
I\'m trying to convert a DocBook XML - File via XSLT to HTML. The XML - File contains an image, which is why I get the following error:

I'm trying to convert a DocBook XML - File via XSLT to HTML. The XML - File contains an image, which is why I get the following error:

build-html:
     [xslt] Transforming into C:\dev\DocBook\DocBookmitXML\output
     [xslt] Processing C:\dev\DocBook\DocBookmitXML\src\BurndownChart.jpg to C:\dev\DocBook\DocBookmitXML\output\BurndownChart.html
     [xslt] Loading stylesheet C:\dev\DocBook\DocBookmitXML\docbook-xsl-1.75.1\xhtml\docbook.xsl
     [xslt] : Fatal Error! org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. Cause: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
     [xslt] Failed to process null

The DocBook-File:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article SYSTEM "../docbook-xml-4/docbookx.dtd" >
<article>
    <articleinfo>
        <title>Freitags um 11.30 Uhr</title>
        <author>
            <firstname>me, myself </firstname>
            <surname>and I</surname>
        </author>
    </articleinfo>
    <sect1 label="1.0"> 
        <title>An introduction to DocBook</title>
        <para>this is text</para>
    </sect1>
    <sect1 label="2.0">
        <title>Core Docbook</title>
        <para>
            <table frame='all'>
                <title>Testtabelle</title>
                <tgroup cols="3">
                    <thead>
                        <row>
                            <entry>Monat</entry>
                            <entry>Woche</entry>
                            <entry>Besucher</entry>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry>Mai</entry>
                            <entry>1</entry>
                            <entry>4711</entry>
                        </row>
                        <row>
                            <entry>Mai</entry>
                            <entry>2</entry>
                            <entry>4712</entry>
                        </row>
                        <row>
                            <entry>Mai</entry>
                            <entry>3&l开发者_JAVA技巧t;/entry>
                            <entry>4713</entry>
                        </row>
                        <row>
                            <entry>Gesamt</entry>
                            <entry></entry>
                            <entry>47110</entry>
                        </row>
                    </tbody>
                </tgroup>
            </table>
        now to the difficult stuff... 
        </para>
    </sect1>
    <sect1 label="2.0">
        <title>A Picture</title> 

            <mediaobject>
                <imageobject>
                    <imagedata format="JPEG" fileref="BurndownChart.jpeg" />
                </imageobject>
            </mediaobject>

    </sect1>
</article>

The Build-File:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="docbook-src" default="build-html">
    <property name="docbook.xsl.dir" value="./docbook-xsl-1.75.1/xhtml" />
    <property name="doc.dir" value="output" />
    <property name="src" value="src" />
    <property name="html.stylesheet" value="${docbook.xsl.dir}/docbook.xsl" />
    <property name="xalan.lib.dir" value="./xalan-j_2_7_1"/>

    <path id="xalan.classpath">
        <fileset dir="${xalan.lib.dir}" id="xalan.fileset">
            <include name="xalan.jar" />
            <include name="xercesImpl.jar" />
        </fileset>
    </path>

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

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

    <target name="build-html" depends="clean,depends" description="Generates HTML files from DocBook">
    <xslt basedir="src" destdir="${doc.dir}" style="${html.stylesheet}" extension=".html">
            <classpath refid="xalan.classpath" />
        </xslt>
    </target>
</project>

Where should I look for the error?


If you take a careful look at the error message, you'll notice that it's actually trying to process the JPEG file, which will of course fail. By default when invoked this way, the xslt task will try to transform all files it finds in the specified directory. You can add add an attribute like includes="*.xml" to tell it to process *.xml files only.

0

精彩评论

暂无评论...
验证码 换一张
取 消