docbook-apps

  • 1.  multiple Xinclude

    Posted 02-20-2008 18:52
    I have a document that use multiple recursive include. Each included
    file is in a subdirectory. For example, I have master.docbook that
    includes chapter1.docbook which includes section1.docbook which includes
    an SVG image file in IMAGES_DIR/image1.svg

    These files are structured as follows:

    ROOT_DIR
    master.docbook
    CHAPTERS_DIR
    chapter1.docbook
    SECTIONS_DIR
    section1.docbook
    IMAGES_DIR
    image1.svg

    When I compile the file master.docbook to produce pdf the images do not
    show, and I get this error during fop:

    [exec] org.apache.batik.bridge.BridgeException:
    file:/home/mansour/PATH_TO/ROOT_DIR/:-1
    [exec] An I/O error occured while processing the URI:
    [exec] "#folder"
    [exec] specified on the element <use>
    [exec] at
    org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source)
    [exec] at
    org.apache.batik.bridge.SVGUseElementBridge.buildCompositeGraphicsNode(Unknown
    Source)
    [exec] at
    org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown
    Source)
    [exec] at
    org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
    [exec] at
    org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
    [exec] at
    org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
    [exec] at
    org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
    [exec] at
    org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)


    However, when I remove the CHAPTERS_DIR and put everything in it with
    the same level as master.docbook, things work fine. For example if I do
    this:

    ROOT_DIR
    master.docbook
    chapter1.docbook
    SECTIONS_DIR
    section1.docbook
    IMAGES_DIR
    image1.svg

    Then things are OK. Of course I change the path in the master.docbook.
    What am I missing??






  • 2.  Re: [docbook-apps] multiple Xinclude

    Posted 02-20-2008 19:47
    Mansour wrote:
    > I have a document that use multiple recursive include. Each included
    > file is in a subdirectory. For example, I have master.docbook that
    > includes chapter1.docbook which includes section1.docbook which includes
    > an SVG image file in IMAGES_DIR/image1.svg
    >
    > These files are structured as follows:
    >
    > ROOT_DIR
    > master.docbook
    > CHAPTERS_DIR
    > chapter1.docbook
    > SECTIONS_DIR
    > section1.docbook
    > IMAGES_DIR
    > image1.svg
    >
    > When I compile the file master.docbook to produce pdf the images do not
    > show, and I get this error during fop:

    [...]


    > However, when I remove the CHAPTERS_DIR and put everything in it with
    > the same level as master.docbook, things work fine. For example if I do
    > this:
    >
    > ROOT_DIR
    > master.docbook
    > chapter1.docbook
    > SECTIONS_DIR
    > section1.docbook
    > IMAGES_DIR
    > image1.svg
    >
    > Then things are OK. Of course I change the path in the master.docbook.
    > What am I missing??

    I remember having seen similar issues in the past. URLs are relative to
    the base URL of the document they appear in, so this info needs to be
    preserved during xinclude processing (i.e. xml:base attributes have to
    be added). May be that didn't happen ?
    I'm not sure this is an issue with docbook. It may be with your xslt
    processor.

    Regards,
    Stefan

    --

    ...ich hab' noch einen Koffer in Berlin...



  • 3.  Re: [docbook-apps] multiple Xinclude

    Posted 02-21-2008 01:04
    Stefan, you were right. It had to do with the xml:base attribute. In the
    generated fo file I found that the resulting path is
    xml:base="SECTION_DIR/IMAGES_DIR/image1.svg". It should have been
    xml:base="CHAPTERS_DIR/SECTION_DIR/IMAGES_DIR/image1.svg". I though
    Xinclude will automatically preserve and adjust this path. I am using
    xalan. How can I fix this ??



    Stefan Seefeld wrote:
    > Mansour wrote:
    >> I have a document that use multiple recursive include. Each included
    >> file is in a subdirectory. For example, I have master.docbook that
    >> includes chapter1.docbook which includes section1.docbook which
    >> includes an SVG image file in IMAGES_DIR/image1.svg
    >>
    >> These files are structured as follows:
    >>
    >> ROOT_DIR
    >> master.docbook
    >> CHAPTERS_DIR
    >> chapter1.docbook
    >> SECTIONS_DIR
    >> section1.docbook
    >> IMAGES_DIR
    >> image1.svg
    >>
    >> When I compile the file master.docbook to produce pdf the images do
    >> not show, and I get this error during fop:
    >
    > [...]
    >
    >
    >> However, when I remove the CHAPTERS_DIR and put everything in it with
    >> the same level as master.docbook, things work fine. For example if I
    >> do this:
    >>
    >> ROOT_DIR
    >> master.docbook
    >> chapter1.docbook
    >> SECTIONS_DIR
    >> section1.docbook
    >> IMAGES_DIR
    >> image1.svg
    >>
    >> Then things are OK. Of course I change the path in the
    >> master.docbook. What am I missing??
    >
    > I remember having seen similar issues in the past. URLs are relative
    > to the base URL of the document they appear in, so this info needs to
    > be preserved during xinclude processing (i.e. xml:base attributes have
    > to be added). May be that didn't happen ?
    > I'm not sure this is an issue with docbook. It may be with your xslt
    > processor.
    >
    > Regards,
    > Stefan
    >




  • 4.  Re: [docbook-apps] multiple Xinclude

    Posted 02-21-2008 01:16
    Mansour wrote:
    > Stefan, you were right. It had to do with the xml:base attribute. In the
    > generated fo file I found that the resulting path is
    > xml:base="SECTION_DIR/IMAGES_DIR/image1.svg". It should have been
    > xml:base="CHAPTERS_DIR/SECTION_DIR/IMAGES_DIR/image1.svg". I though
    > Xinclude will automatically preserve and adjust this path. I am using
    > xalan. How can I fix this ??

    My reading of http://www.w3.org/TR/xinclude/#base is that the injected
    xml:base should make sure relative URIs remain valid. If your processor
    (xalan) doesn't generate the right xml:base attribute it is a bug.

    Regards,
    Stefan

    --

    ...ich hab' noch einen Koffer in Berlin...



  • 5.  Re: [docbook-apps] multiple Xinclude

    Posted 02-21-2008 08:04
    I am not setting xml:base in any of my Xincludes. My understanding is
    that xml:base will be correstly generated by the docbook xslt. I am
    using relative paths for my files. Is't a requirement that I use
    xml:base in my Xincludes to get the generated Xinclude correctly ?



    Stefan Seefeld wrote:
    > Mansour wrote:
    >> Stefan, you were right. It had to do with the xml:base attribute. In
    >> the generated fo file I found that the resulting path is
    >> xml:base="SECTION_DIR/IMAGES_DIR/image1.svg". It should have been
    >> xml:base="CHAPTERS_DIR/SECTION_DIR/IMAGES_DIR/image1.svg". I though
    >> Xinclude will automatically preserve and adjust this path. I am using
    >> xalan. How can I fix this ??
    >
    > My reading of http://www.w3.org/TR/xinclude/#base is that the injected
    > xml:base should make sure relative URIs remain valid. If your
    > processor (xalan) doesn't generate the right xml:base attribute it is
    > a bug.
    >
    > Regards,
    > Stefan
    >




  • 6.  Re: [docbook-apps] multiple Xinclude

    Posted 02-21-2008 08:56
    Mansour schrieb:
    > I am not setting xml:base in any of my Xincludes. My understanding is
    > that xml:base will be correstly generated by the docbook xslt. I am
    > using relative paths for my files. Is't a requirement that I use
    > xml:base in my Xincludes to get the generated Xinclude correctly ?
    >
    I don't think you have to set the xml:base attribute. But you need a
    correct working XSLT processor.

    You can try Saxon together with Xerces libraries (like I do), described
    here:
    http://www.sagehill.net/docbookxsl/InstallingAProcessor.html#UsingSaxon

    Or check if you use the latest Xalan version and try to upgrade your
    Xalan processor. (But nevertheless the latest version uses Xerces
    libraries too.)

    Regards

    Stefan



  • 7.  Re: [docbook-apps] multiple Xinclude

    Posted 02-21-2008 11:27
    Mansour wrote:
    > I am not setting xml:base in any of my Xincludes. My understanding is
    > that xml:base will be correstly generated by the docbook xslt. I am
    > using relative paths for my files. Is't a requirement that I use
    > xml:base in my Xincludes to get the generated Xinclude correctly ?

    No. It should be generated by the tool you use.

    Regards,
    Stefan

    --

    ...ich hab' noch einen Koffer in Berlin...