Skip to content
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
Closed

xincluding an element xincluded into another doc fails #273

dwcramer opened this issue Apr 5, 2018 · 3 comments

Comments

@dwcramer
Copy link

@dwcramer 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
Copy link
Owner

@ndw ndw commented Apr 6, 2018

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

@dwcramer
Copy link
Author

@dwcramer 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 added a commit that referenced this issue Dec 8, 2018
ndw added a commit that referenced this issue Dec 8, 2018
@ndw
Copy link
Owner

@ndw 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
ndw added a commit that referenced this issue Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants