OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-tc message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Fwd: [docbook-apps] DcBk assembly- contentonly=true - is including the meta-info of discarded subsuming root element - Is this correct behavior?


This message on the docbook-apps lists points out an inconsistency in the documentation regarding assemblies. The contentonly="yes" attribute is intended to strip off the root element of a module when pulled into an assembly. That permits replacing the xml:id attribute on the module, for example. The Definitive Guide describes the contentonly attribute as follows:

"contentonly - Indicates if only the content should be copied when including a resource"
[http://tdg.docbook.org/tdg/5.1/module.html]

The assemble.xsl stylesheet does just this: it strips off the root element and copies all children.

However, elsewhere in The Definitive Guide it says this:

"If contentonly is true, then only the content of the document element, and not the document element itself, is included. Any metadata associated with the document element is also discarded."
[http://tdg.docbook.org/tdg/5.1/ch06.html#modules]

The last sentence was news to me. I looked through the minutes, and I don't recall the discussion or decision to exclude metadata (info element) when contentonly="yes". Does anyone else? I'm not sure why we would want that, because it would exclude the title of the element if it were in the info. If some of the info content in the document element is not desired, then we have the merge element in the module element to override it.

I think this example he provides points out two bugs in the merge process of assemble.xsl. First, it should never generate a second info element, it should always generate one with merged content. Second, it should take into account a title inside or outside of the info (likewise for titleabbrev and subtitle). Those are the three elements that can appear inside info that are content, not just metadata.

So I'm suggesting that we remove the second sentence above and fix the assemble.xsl stylesheet. Or did I get this wrong?

Thoughts?

Bob


-------- Forwarded Message --------
Subject: [docbook-apps] DcBk assembly- contentonly=true - is including the meta-info of discarded subsuming root element - Is this correct behavior?
Date: Thu, 21 Sep 2017 11:42:50 -0700
From: Otto Hirr <ottohirr@gmail.com>
To: docbook-apps@lists.oasis-open.org

Greetings,

I am beginning to use DocBook Assemblies. I may have a
misunderstanding of "contentonly" attribute of "module" element.

The //contentonly="true"// seems to pull in the meta info of the
subsuming "topic" 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.

By way of running the sample topics and assemble shown below, it seems
the implementation of //contentonly="true"//, is simply to discard the
root element, "topic". This would be a strict elimination of the
subsuming element, "topic."

However this simplistic kind of implementation would then leave the
info which is a meta-detail of the now-discarded "topic" element.

This results in an invalid docbook file.

(Below I give two topics, an assemble, the output generated, and the
output I would have expected.)

(My understanding is that OxygenXMLv19 is providing 1.79.2, which is
the environment in which I ran this sample file set.)

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

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


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

Best regards,

..Otto

====Topic1====file:prob1-topic1.xml====>
<?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>
<====Topic1====

====Topic2====file:prob1-topic2.xml====>
<?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>
<====Topic2====

====Assembly====file:prob1-assy1.xml>
<?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>
<====Assembly====

====Result====>
<?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>
<====Result====

====Result of what I thought should be generated====>
<?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>
<====Result of what I thought should be generated====

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]