docbook-apps

  • 1.  Re: [docbook-apps] xml:base problem with nested XIncludes

    Posted 07-02-2009 20:56
    Hi Ron,
    I'm not able to duplicate this problem. I'm using your files with Oxygen
    10.3, DocBook XSL 1.75.1, Saxon 6 and XEP 4.13, Java 1.6.0_05.

    Two things:

    1. I didn't see where you described the directory structure containing your
    files. As far as I can tell, they all reside in the the current directory,
    except the graphic which is in a subdirectory named 'images'. Is that
    correct? I wasn't clear what you expected the src attribute in the fo file
    to be, as compared to what you got.

    2. Normally the XInclude processor does not add xml:base unless an included
    file is in a different directory, and that doesn't seem to be the case here.

    I'm wondering where the full path information came from, because it does not
    appear to be in the XML files. Normally a processor will work with relative
    paths, but the error message indicates a full path. Is a catalog involved
    here?

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net


    ----- Original Message -----
    From: "Ron Catterall" <ron@catterall.net>
    To: <docbook-apps@lists.oasis-open.org>
    Sent: Thursday, July 02, 2009 1:09 PM
    Subject: [docbook-apps] xml:base problem with nested XIncludes


    > Hi
    >
    > A problem with nested XIncludes that I raised in 2005 has either not
    > been resolved, or has risen again in DB5 and 1.75.1. The problem is in
    > the value of xml:base which results in the generation of bad paths to
    > files referenced in a nested XInclude. A sample program to demonstrate
    > the problem is below, and the separate files are attached. XEP reports
    > the bad paths - see below - but fop just fails to produce any diagnostic
    > output. A work around is to pre-process the XIncludes and appropriate
    > xsl code is in the file copy.xsl
    >
    > root0.xml XIncludes root1.xml which XIncludes file0.xml which references
    > a jpg file in a
    . The file cannot be found because the xml:base
    > is wrongly applied.
    >
    > Tool chain Oxygen 10.3, DB5, XSL 1.75.1, Saxon-6.5.5 and
    > XEP-4.10-20070727.
    > java version "1.5.0_19"
    > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-306)
    > Java HotSpot(TM) Client VM (build 1.5.0_19-138, mixed mode)
    >
    >
    >
    > ---File: root0.xml
    >
    >
    >
    > xml:id="test" xmlns="http://docbook.org/ns/docbook" version="5.0"
    > xml:lang="EN">
    > <info>
    >
    > </info>
    > <para></para>
    > <xi:include href="root1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >

    >
    >
    >
    > ---File: root1.xml
    >
    >
    > <appendix xml:id="file0" xmlns="http://docbook.org/ns/docbook"
    > version="5.0" xml:lang="EN">
    > <info>
    >
    > </info>
    > <xi:include href="file0.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    > </appendix>
    >
    >
    >
    > ---File: file0.xml
    >
    >
    >
    > version="5.0" xml:lang="EN">
    > <info></info>
    >

    > <mediaobject>
    > <imageobject role="xhml">
    > <imagedata fileref="images/Old_road_grass-54X.jpg" format="JPG"
    > width="100%" contentwidth="12.0cm" align="center"/>
    > </imageobject>
    > <imageobject role="fo">
    > <imagedata fileref="images/Old_road_grass-54.jpg" format="JPG"
    > width="100%" contentwidth="9.0cm" align="center"/>
    > </imageobject>
    > <para role="Start">Medieval Road</para>
    > </mediaobject>
    >

    >

    >
    >
    >
    > ---File: root.xsl
    >
    > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > version="1.0">
    > <xsl:import
    > href="/Applications/Utilities/oxygen/10.3/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.75.1/fo/docbook.xsl"/>
    > </xsl:stylesheet>
    >
    >
    >
    > ---XEP failure report
    > ---The image file referred to in file0.xml cannot be found.
    > ---Nested Xinclude problem - XEP gives the bad filename
    > [error] Failed to create image
    > file:/Library/WebServer/Documents/_XML/_test//Library/WebServer/Documents/_XML/_test/images/Old_road_grass-54.jpg
    > of type image/jpeg
    > [error] java.io.FileNotFoundException:
    > /Library/WebServer/Documents/_XML/_test/Library/WebServer/Documents/_XML/_test/images/Old_road_grass-54.jpg
    > (No such file or directory)
    >
    >
    >
    > If the nested Xincludes are expanded first using the following XSL, then
    > the nested problem is avoided and all is well, the image file is found
    > and displayed
    > ---File: copy.xsl
    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > exclude-result-prefixes="xi" xmlns:xi="http://www.w3.org/2001/XInclude">
    > <xsl:output indent="yes" method="xml" encoding="UTF-8"/>
    > <xsl:strip-space elements="*"/>
    >
    > <xsl:template match="/">
    > <xsl:apply-templates mode="copy" select="."/>
    > </xsl:template>
    >
    > <xsl:template match="*|text()|@*" mode="copy">
    > <xsl:copy>
    > <xsl:apply-templates mode="copy" select="@*"/>
    > <xsl:apply-templates mode="copy"/>
    > </xsl:copy>
    > </xsl:template>
    >
    > <xsl:template match="@*[name()='xml:base']" mode="copy"/>
    >
    > <xsl:template match="*"/>
    > </xsl:stylesheet>
    >
    >
    > Ron
    > --
    > Ron Catterall Ph.D. D.Sc.
    > ron@catterall.net
    > http://catterall.net
    >


    --------------------------------------------------------------------------------


    >
    >
    >
    > xml:lang="EN">
    > <info>
    >
    > </info>
    > <para></para>
    > <xi:include href="root1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >

    >


    --------------------------------------------------------------------------------


    >
    >
    > <appendix xml:id="file0" xmlns="http://docbook.org/ns/docbook"
    > version="5.0" xml:lang="EN">
    > <info>
    >
    > </info>
    > <xi:include href="file0.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    > </appendix>
    >


    --------------------------------------------------------------------------------


    >
    >
    >
    > version="5.0" xml:lang="EN">
    > <info></info>
    >

    > <mediaobject>
    > <imageobject role="xhml">
    > <imagedata fileref="images/Old_road_grass-54X.jpg" format="JPG"
    > width="100%" contentwidth="12.0cm" align="center"/>
    > </imageobject>
    > <imageobject role="fo">
    > <imagedata fileref="images/Old_road_grass-54.jpg" format="JPG"
    > width="100%" contentwidth="9.0cm" align="center"/>
    > </imageobject>
    > <para role="Start">Medieval Road</para>
    > </mediaobject>
    >

    >

    >


    --------------------------------------------------------------------------------


    >
    > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > version="1.0">
    > <xsl:import
    > href="/Applications/Utilities/oxygen/10.3/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.75.1/fo/docbook.xsl"/>
    > </xsl:stylesheet>


    --------------------------------------------------------------------------------


    >
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    > exclude-result-prefixes="xi"
    > xmlns:xi="http://www.w3.org/2001/XInclude">
    > <xsl:output indent="yes" method="xml" encoding="UTF-8"/>
    >
    > <xsl:strip-space elements="*"/>
    >
    >
    > <xsl:template match="/">
    > <xsl:apply-templates mode="copy" select="."/>
    > </xsl:template>
    >
    > <xsl:template match="*|text()|@*" mode="copy">
    > <xsl:copy>
    > <xsl:apply-templates mode="copy" select="@*"/>
    > <xsl:apply-templates mode="copy"/>
    > </xsl:copy>
    > </xsl:template>
    >
    > <xsl:template match="@*[name()='xml:base']" mode="copy"/>
    >
    > <xsl:template match="*"/>
    > </xsl:stylesheet>
    >




  • 2.  Re: [docbook-apps] xml:base problem with nested XIncludes

    Posted 07-02-2009 21:33
    Hi Bob

    Could it be XEP 4.10? I'll move to 4.13 and check. I can't see the
    Java version being responsible. I checked several times with my
    too-chain, it is reproducible with XEP 4.10.

    Bob Stayton wrote:
    > Hi Ron,
    > I'm not able to duplicate this problem. I'm using your files with
    > Oxygen 10.3, DocBook XSL 1.75.1, Saxon 6 and XEP 4.13, Java 1.6.0_05.
    >
    Do you see the picture without doing the 'copy' xsl first? I don't.

    > Two things:
    >
    > 1. I didn't see where you described the directory structure containing
    > your files. As far as I can tell, they all reside in the the current
    > directory, except the graphic which is in a subdirectory named
    > 'images'. Is that correct? I wasn't clear what you expected the src
    > attribute in the fo file to be, as compared to what you got.
    >
    Sorry, I omitted the directory structure. You are right, the files are
    all in one directory and images is a subdirectory. I expected images/...jpg

    > 2. Normally the XInclude processor does not add xml:base unless an
    > included file is in a different directory, and that doesn't seem to be
    > the case here.
    >
    The XInclude processing seems to be fine, no problems. It is only the
    file that is referenced by the nested XInclude that gets the wrong (full
    and duplicated) path and I don't see the picture. As I remember the
    2005 problem did not generate full paths, it just duplicated the
    'images' directory. maybe I am wrong in thinking it the same problem.

    > I'm wondering where the full path information came from, because it does
    > not appear to be in the XML files. Normally a processor will work with
    > relative paths, but the error message indicates a full path. Is a
    > catalog involved here?
    >
    No, nothing via a catalog. The only full path I have is for docbook.xsl

    I'll post when I've checked with XEP 4.13.

    Ron


    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    >
    > ----- Original Message ----- From: "Ron Catterall" <ron@catterall.net>
    > To: <docbook-apps@lists.oasis-open.org>
    > Sent: Thursday, July 02, 2009 1:09 PM
    > Subject: [docbook-apps] xml:base problem with nested XIncludes
    >
    >
    >> Hi
    >>
    >> A problem with nested XIncludes that I raised in 2005 has either not
    >> been resolved, or has risen again in DB5 and 1.75.1. The problem is in
    >> the value of xml:base which results in the generation of bad paths to
    >> files referenced in a nested XInclude. A sample program to demonstrate
    >> the problem is below, and the separate files are attached. XEP reports
    >> the bad paths - see below - but fop just fails to produce any diagnostic
    >> output. A work around is to pre-process the XIncludes and appropriate
    >> xsl code is in the file copy.xsl
    >>
    >> root0.xml XIncludes root1.xml which XIncludes file0.xml which references
    >> a jpg file in a
    . The file cannot be found because the xml:base
    >> is wrongly applied.
    >>
    >> Tool chain Oxygen 10.3, DB5, XSL 1.75.1, Saxon-6.5.5 and
    >> XEP-4.10-20070727.
    >> java version "1.5.0_19"
    >> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-306)
    >> Java HotSpot(TM) Client VM (build 1.5.0_19-138, mixed mode)
    >>
    >>
    >>
    >> ---File: root0.xml
    >>
    >>
    >>
    >> xml:id="test" xmlns="http://docbook.org/ns/docbook" version="5.0"
    >> xml:lang="EN">
    >> <info>
    >>
    >> </info>
    >> <para></para>
    >> <xi:include href="root1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >>

    >>
    >>
    >>
    >> ---File: root1.xml
    >>
    >>
    >> <appendix xml:id="file0" xmlns="http://docbook.org/ns/docbook"
    >> version="5.0" xml:lang="EN">
    >> <info>
    >>
    >> </info>
    >> <xi:include href="file0.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >> </appendix>
    >>
    >>
    >>
    >> ---File: file0.xml
    >>
    >>
    >>
    >> version="5.0" xml:lang="EN">
    >> <info></info>
    >>

    >> <mediaobject>
    >> <imageobject role="xhml">
    >> <imagedata fileref="images/Old_road_grass-54X.jpg" format="JPG"
    >> width="100%" contentwidth="12.0cm" align="center"/>
    >> </imageobject>
    >> <imageobject role="fo">
    >> <imagedata fileref="images/Old_road_grass-54.jpg" format="JPG"
    >> width="100%" contentwidth="9.0cm" align="center"/>
    >> </imageobject>
    >> <para role="Start">Medieval Road</para>
    >> </mediaobject>
    >>

    >>

    >>
    >>
    >>
    >> ---File: root.xsl
    >>
    >> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> version="1.0">
    >> <xsl:import
    >> href="/Applications/Utilities/oxygen/10.3/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.75.1/fo/docbook.xsl"/>
    >>
    >> </xsl:stylesheet>
    >>
    >>
    >>
    >> ---XEP failure report
    >> ---The image file referred to in file0.xml cannot be found.
    >> ---Nested Xinclude problem - XEP gives the bad filename
    >> [error] Failed to create image
    >> file:/Library/WebServer/Documents/_XML/_test//Library/WebServer/Documents/_XML/_test/images/Old_road_grass-54.jpg
    >>
    >> of type image/jpeg
    >> [error] java.io.FileNotFoundException:
    >> /Library/WebServer/Documents/_XML/_test/Library/WebServer/Documents/_XML/_test/images/Old_road_grass-54.jpg
    >>
    >> (No such file or directory)
    >>
    >>
    >>
    >> If the nested Xincludes are expanded first using the following XSL, then
    >> the nested problem is avoided and all is well, the image file is found
    >> and displayed
    >> ---File: copy.xsl
    >>
    >> <xsl:stylesheet version="1.0"
    >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> exclude-result-prefixes="xi" xmlns:xi="http://www.w3.org/2001/XInclude">
    >> <xsl:output indent="yes" method="xml" encoding="UTF-8"/>
    >> <xsl:strip-space elements="*"/>
    >>
    >> <xsl:template match="/">
    >> <xsl:apply-templates mode="copy" select="."/>
    >> </xsl:template>
    >>
    >> <xsl:template match="*|text()|@*" mode="copy">
    >> <xsl:copy>
    >> <xsl:apply-templates mode="copy" select="@*"/>
    >> <xsl:apply-templates mode="copy"/>
    >> </xsl:copy>
    >> </xsl:template>
    >>
    >> <xsl:template match="@*[name()='xml:base']" mode="copy"/>
    >>
    >> <xsl:template match="*"/>
    >> </xsl:stylesheet>
    >>
    >>
    >> Ron
    >> --
    >> Ron Catterall Ph.D. D.Sc.
    >> ron@catterall.net
    >> http://catterall.net
    >>
    >
    >
    > --------------------------------------------------------------------------------
    >
    >
    >
    >>
    >>
    >>
    >> version="5.0" xml:lang="EN">
    >> <info>
    >>
    >> </info>
    >> <para></para>
    >> <xi:include href="root1.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >>

    >>
    >
    >
    > --------------------------------------------------------------------------------
    >
    >
    >
    >>
    >>
    >> <appendix xml:id="file0" xmlns="http://docbook.org/ns/docbook"
    >> version="5.0" xml:lang="EN">
    >> <info>
    >>
    >> </info>
    >> <xi:include href="file0.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
    >> </appendix>
    >>
    >
    >
    > --------------------------------------------------------------------------------
    >
    >
    >
    >>
    >>
    >>
    >> version="5.0" xml:lang="EN">
    >> <info></info>
    >>

    >> <mediaobject>
    >> <imageobject role="xhml">
    >> <imagedata fileref="images/Old_road_grass-54X.jpg" format="JPG"
    >> width="100%" contentwidth="12.0cm" align="center"/>
    >> </imageobject>
    >> <imageobject role="fo">
    >> <imagedata fileref="images/Old_road_grass-54.jpg" format="JPG"
    >> width="100%" contentwidth="9.0cm" align="center"/>
    >> </imageobject>
    >> <para role="Start">Medieval Road</para>
    >> </mediaobject>
    >>

    >>

    >>
    >
    >
    > --------------------------------------------------------------------------------
    >
    >
    >
    >>
    >> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> version="1.0">
    >> <xsl:import
    >> href="/Applications/Utilities/oxygen/10.3/oxygen/frameworks/docbook/5.0/docbook-xsl-ns-1.75.1/fo/docbook.xsl"/>
    >>
    >> </xsl:stylesheet>
    >
    >
    > --------------------------------------------------------------------------------
    >
    >
    >
    >>
    >> <xsl:stylesheet version="1.0"
    >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    >> exclude-result-prefixes="xi"
    >> xmlns:xi="http://www.w3.org/2001/XInclude">
    >> <xsl:output indent="yes" method="xml" encoding="UTF-8"/>
    >>
    >> <xsl:strip-space elements="*"/>
    >>
    >>
    >> <xsl:template match="/">
    >> <xsl:apply-templates mode="copy" select="."/>
    >> </xsl:template>
    >>
    >> <xsl:template match="*|text()|@*" mode="copy">
    >> <xsl:copy>
    >> <xsl:apply-templates mode="copy" select="@*"/>
    >> <xsl:apply-templates mode="copy"/>
    >> </xsl:copy>
    >> </xsl:template>
    >>
    >> <xsl:template match="@*[name()='xml:base']" mode="copy"/>
    >>
    >> <xsl:template match="*"/>
    >> </xsl:stylesheet>
    >>
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >

    --
    Ron Catterall Ph.D. D.Sc.
    ron@catterall.net
    http://catterall.net