docbook-apps

  • 1.  Troubles using Sun's internal Xerces and Xalan Parsers

    Posted 09-11-2009 07:24
    Hi,

    In order to reduce the amount of external dependencies in one of my
    projects I'd like to replace xercesImpl.jar, xalan.jar and related
    dependencies by using the internal tools of Java 1.6 (Sun).
    One thing I tried is to modify fop.bat of the FOP-0.95-distribution,
    i.e. to comment out xml-apis, xml-apis-ext, xercesImpl, xalan, and
    serializer

    >C:\apps\fop-0.95\fop -xml um.xml -xsl docbook\custom\xsl\fo.xsl -pdf um.pdf
    Compilerwarnungen:
    file:/foo/docbook/xsl/fo/table.xsl: line 451: Attribut 'border-start-style' befindet sich nicht in einem Element.
    file:/foo/docbook/xsl/fo/table.xsl: line 452: Attribut 'border-end-style' befindet sich nicht in einem Element.
    file:/foo/docbook/xsl/fo/table.xsl: line 453: Attribut 'border-top-style' befindet sich nicht in einem Element.
    file:/foo/docbook/xsl/fo/table.xsl: line 454: Attribut 'border-bottom-style' befindet sich nicht in einem Element.
    file:/foo/docbook/xsl/fo/index.xsl: line 351: Attribut 'rx:key' befindet sich nicht in einem Element.
    FEHLER: 'Syntaxfehler in '* or $generate.index != 0'.'
    SCHWER WIEGENDER FEHLER: 'Die Formatvorlage konnte nicht kompiliert werden.'
    10.09.2009 21:02:41 org.apache.fop.cli.Main startFOP
    SCHWERWIEGEND: Exception
    javax.xml.transform.TransformerConfigurationException: Die Formatvorlage konnte nicht kompiliert werden.
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:217)
    at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:125)
    at org.apache.fop.cli.Main.startFOP(Main.java:166)
    at org.apache.fop.cli.Main.main(Main.java:197)
    Caused by: javax.xml.transform.TransformerConfigurationException: Die Formatvorlage konnte nicht kompiliert werden.
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(Unknown Source)
    at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:198)
    ... 3 more

    A similar exception is raised when I use my own method to do the
    transformation through JAXP (this time I use the docbook HTML
    stylesheets and not the FO ones):

    11-Sep-09 09:12:32.172 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/autoidx.xsl: line 532: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.172 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/autoidx.xsl: line 581: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.172 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/autoidx.xsl: line 604: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.172 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/lists.xsl: line 775: Attribute 'type' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/callout.xsl: line 105: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/xref.xsl: line 177: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/xref.xsl: line 997: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/formal.xsl: line 191: Attribute 'id' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/formal.xsl: line 332: Attribute 'id' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 103: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 138: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 148: Attribute 'target' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 175: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 693: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 912: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 1037: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 1166: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 1267: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/inline.xsl: line 1304: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/glossary.xsl: line 256: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/glossary.xsl: line 325: Attribute 'href' outside of element. at location unknown
    11-Sep-09 09:12:32.188 INFO XsltUtil$1: XSLT Stylesheet Info: file:/c:/foo/docbook/xsl/html/annotations.xsl: line 117: Attribute 'onClick' outside of element. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* or $generate.index != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/autotoc.xsl: line 373: Error parsing XPath expression '* or $generate.index != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/autotoc.xsl: line 373: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* or $generate.index != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/autotoc.xsl: line 493: Error parsing XPath expression '* or $generate.index != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/autotoc.xsl: line 493: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 32: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 32: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 83: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 83: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 128: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 128: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 271: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 271: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 290: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 290: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: Syntax error in '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 310: Error parsing XPath expression '* and $process.source.toc != 0'. at location unknown
    11-Sep-09 09:12:32.188 WARNING XsltUtil$1: XSLT Stylesheet Recoverable Error: file:/c:/foo/docbook/xsl/html/toc.xsl: line 310: Required attribute 'test' is missing. at location unknown
    11-Sep-09 09:12:32.188 SEVERE XsltUtil$1: XSLT Stylesheet Fatal Error: Could not compile stylesheet at location unknown


    Is it just not possible to use the internal parsers? Or do I need to
    change some configuration?

    Thanks for your help,
    Marco




  • 2.  Re: [docbook-apps] Troubles using Sun's internal Xerces and Xalan Parsers

    Posted 09-11-2009 07:47
    Marco Soldati wrote:

    > In order to reduce the amount of external dependencies in one of my
    > projects I'd like to replace xercesImpl.jar, xalan.jar and related
    > dependencies by using the internal tools of Java 1.6 (Sun).

    Sun JDK since version 1.5 uses XSLTC as XSLT processor. This compiler is
    not able to cope with complex transformations like DocBook one. So you
    should stick with Saxon (or alternatively normal Xalan) as your XSLT
    processor of choice.

    There are also some quirks in Xerces bundled in JDK, but I'm not sure
    whether this affects your scenario.

    Anyway if you use Java toolchain for processing DocBook the best is to
    use Apache Xerces parser and Saxon XSLT processor.

    Jirka

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------