Docbook assembly contentonly - problem(?)

ottoh
Posts: 4

Docbook assembly contentonly - problem(?)

Wed Sep 20, 2017 11:29 pm

Greetings,

Beginning to use DocBook Assemblies.
The contentonly="true" seems to pull in the meta info of the subsuming element. I was under impression from another source that the contentonly would pull in the content of the subsuming element without the meta-information of the subsuming element.

Sample: 2 topics and 1 assembly as follows:
topic1:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<topic xml:id="t1" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.1" >
    <info> <title>prob1-topic1</title> </info>
    <para>Paragraph contained in topic #1.</para>
</topic>

topic2:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/docbook.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<topic xml:id="t2" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.1" >
    <info> <title>prob1-topic2</title> </info>
    <para>Paragraph contained in topic #2.</para>
</topic>

assembly:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://docbook.org/xml/5.1/rng/assembly.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://docbook.org/xml/5.1/sch/assembly.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<assembly version="5.1" xmlns="http://docbook.org/ns/docbook">
    <resources>
        <resource href="prob1-topic1.xml" xml:id="topic1"/>
        <resource href="prob1-topic2.xml" xml:id="topic2"/>
    </resources>
   
    <structure renderas="book">
        <merge><title>Book title of sample assembly of topics</title></merge>

        <module renderas="chapter" xml:id="chapter1">
            <merge><title>Title of first chapter</title></merge>
            <module contentonly="true" resourceref="topic1"/>
            <module contentonly="true" resourceref="topic2"/>
        </module>
    </structure>
</assembly>

Which generates the following:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.1">
    <info>
        <title>Book title of sample assembly of topics</title>
    </info>
    <chapter xml:id="chapter1">
        <info>
            <title>Title of first chapter</title>
        </info>
        <info xmlns:xlink="http://www.w3.org/1999/xlink">
            <title>prob1-topic1</title>
        </info>
        <para xmlns:xlink="http://www.w3.org/1999/xlink">Paragraph contained in topic #1.</para>

        <info xmlns:xlink="http://www.w3.org/1999/xlink">
            <title>prob1-topic2</title>
        </info>
        <para xmlns:xlink="http://www.w3.org/1999/xlink">Paragraph contained in topic #2.</para>
    </chapter>
</book>

The info elements of the included topics should not be there, as I understand.
I thought the correct output would be similar to the following:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.1">
    <info>
        <title>Book title of sample assembly of topics</title>
    </info>
    <chapter xml:id="chapter1">
        <info>
            <title>Title of first chapter</title>
        </info>

        <para xmlns:xlink="http://www.w3.org/1999/xlink">Paragraph contained in topic #1.</para>
        <para xmlns:xlink="http://www.w3.org/1999/xlink">Paragraph contained in topic #2.</para>
    </chapter>
</book>


It seems the implementation of contentonly=true is simply to discard the root element, topic. However this simplistic kind of implementation would then leave the info which is a meta-detail of the now-discarded root element.

It would seem that the logical complete implementation would be to discard the root-element and any accompanying meta details of the info-element which is associated with the root-element.

Please correct any misunderstanding I have, still very much a beginner.


Also, should there be an xml:base generated for each item that is transcluded (if that is the correct term)?

Best regards,
..Otto
Radu
Posts: 5088

Re: Docbook assembly contentonly - problem(?)

Fri Sep 22, 2017 7:39 am

Hi Otto,

Sorry about the delay, I see you already wrote on the Docbook Apps Users List, I'm linking to your post for completion:

https://lists.oasis-open.org/archives/docbook-apps/201709/msg00011.html

Yesterday I was working on an answer for this thread but I did not finish in time to submit it. Looking at the replies you got my answer was similar with the one you received on the Docbook Apps.
In general for Docbook-related questions you can write on the Docbook Apps list. I'm also registered there and if I can help with anything I will.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests