New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xincluding an element xincluded into another doc fails #273

Closed
dwcramer opened this Issue Apr 5, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@dwcramer
Copy link

dwcramer commented Apr 5, 2018

Setup:

  • Book2.xml xincludes section.xml, which contains only a section with xml:id="xincluded-section"
  • Book1.xml xincludes Book2.xml with the xpointer set to grab xincluded-section
    Processed with a one-step pipeline that only does a <p:xinclude/>.

Book1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0"
    xml:id="book.hgm_ml2_kdb">
    <title>Book1 title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb">
        <title>Chapter1 title</title>
        <xi:include href="Book2.xml" xpointer="xincluded-section"/>
    </chapter>
</book>

Book2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<book 
    xmlns="http://docbook.org/ns/docbook" 
    xmlns:xi="http://www.w3.org/2001/XInclude" 
    version="5.0"
    xml:id="book.hgm_ml2_kdb2">
    <title>Book title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb2">
        <title>Chapter title</title>
        <xi:include href="section.xml"/>
    </chapter>
</book>

section.xml:

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook" 
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="xincluded-section">
    <title>xincluded section</title>
    <para>foobar</para>
</section>

xinclude.xpl:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc" name="main">
    
    <p:input port="source" primary="true"/>
    <p:output port="result"/>    
    <p:input port="parameters" kind="parameter"/>
   
    <p:xinclude />
    
</p:declare-step>

Expected result:

Book1.xml and Book2.xml should both process, resolving the contents of section.xml into the doc.

Actual Result:

Processing Book1.xml with the same simple p:xinclude pipeline fails with the following error:

dcramer@anatine-2 ~/dcramer_anatine/depot/www/pm/techdocs/docsource/soc-conversion-testing/test-suite/xinclude-test
$ /Applications/xmlcalabash-1.1.20-98/calabash -i Book1.xml xinclude.xpl
ERROR: xinclude.xpl:8:19:XInclude resource error (Book2.xml) and no fallback provided.
ERROR: XInclude resource error (Book2.xml) and no fallback provided.

Processing Book2.xml with a simple p:xinclude pipeline works.

dcramer@anatine-2 ~/dcramer_anatine/depot/www/pm/techdocs/docsource/soc-conversion-testing/test-suite/xinclude-test
$ /Applications/xmlcalabash-1.1.20-98/calabash -i Book2.xml xinclude.xpl
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="book.hgm_ml2_kdb2">
    <title>Book title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb2">
        <title>Chapter title</title>
        <section xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="xincluded-section">
    <title>xincluded section</title>
    <para>foobar</para>
</section>
    </chapter>
</book>
@ndw

This comment has been minimized.

Copy link
Owner

ndw commented Apr 6, 2018

Out of curiosity, if you remove the xpointer attribute, does it succeed?

@dwcramer

This comment has been minimized.

Copy link

dwcramer commented Apr 6, 2018

Yes that succeeds, given a sufficiently generous definition of "success" :-)

dcramer@anatine-2 ~/dcramer_anatine/depot/www/pm/techdocs/docsource/soc-conversion-testing/test-suite/xinclude-test
$ cat Book3.xml
<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0"
    xml:id="book.hgm_ml2_kdb">
    <title>Book1 title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb">
        <title>Chapter1 title</title>
        <xi:include href="Book2.xml" />
    </chapter>
</book>

dcramer@anatine-2 ~/dcramer_anatine/depot/www/pm/techdocs/docsource/soc-conversion-testing/test-suite/xinclude-test
$ /Applications/xmlcalabash-1.1.20-98/calabash -i Book3.xml xinclude.xpl
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="book.hgm_ml2_kdb">
    <title>Book1 title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb">
        <title>Chapter1 title</title>
        <book version="5.0" xml:id="book.hgm_ml2_kdb2">
    <title>Book title</title>
    <chapter xml:id="chapter.jgm_ml2_kdb2">
        <title>Chapter title</title>
        <section xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="xincluded-section">
    <title>xincluded section</title>
    <para>foobar</para>
</section>
    </chapter>
</book>
    </chapter>
</book>

@ndw ndw referenced this issue Dec 8, 2018

Open

XInclude test #116

ndw added a commit that referenced this issue Dec 8, 2018

ndw added a commit that referenced this issue Dec 8, 2018

@ndw

This comment has been minimized.

Copy link
Owner

ndw commented Dec 9, 2018

I believe this is fixed in 1.1.23. Please reopen if I'm mistaken.

@ndw ndw closed this Dec 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment