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


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

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

Subject: Re: [docbook] section element

Hi Mats,

I have concerns about changing the schema to allow sections directly under book. If you're looking for a solution in the schema, I think assemblies are the way to go.

That said, here is a strategy we've used with xinclude that may be useful. This depends on xmllint (there may be other processors that will do this, but xmllint works for me, so I haven't investigated further). It may also stretch the bounds of the xinclude standard, but if you use xmllint, it works and saves you from changing the schema.

If you want to turn that section into a preface, the following will work:

  <preface xml:id="some_id">
    <xi:include href="source/somesection.xml"

If you want to grab the title, too, you can use the following (this just adds a statement to grab the title from the included file instead of hard coding it):

  <preface xml:id="app.casestudy-lego">
    <title><xi:include href="source/somesection.xml"
    <xi:include href="source/somesection.xml"

You can, of course do other things. You could completely wrap the section in a chapter and just use a simpler xinclude statement that just pulls in the whole file. And you can create any element (not just preface) that will parse correctly when everything is expanded. And if you want to live really dangerously (I'm not recommending this; as the liquor ads advise, "Use responsibly"), the stylesheets are more relaxed than the schema when it comes to validation. They will sometimes handle things that are invalid, but still well formed). I haven't tried this, but they might process a section directly under a book element (and they might not:-).

Best regards,
Dick Hamilton
XML Press
XML for Technical Communicators

On Nov 18, 2014, at 5:48, Mats Broberg <mats.broberg@gmail.com> wrote:

> Greetings,
> In DocBook, the “section” element cannot appear directly under “book” or “part”, but must have a “chapter” parent. So what to do if a “section” is reused (as xincludes) between publications and sometimes must appear at the “chapter” level and sometimes at a “section” and even a subsection level?
> “section” is allowed directly under “article”, but “article” seems like the wrong element for a 300+ page publication (such as a manual).
> Best regards,
> Mats

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