DocBook - numbering sections - newbie question

Discussion in 'XML' started by Richard Shea, Jan 13, 2004.

  1. Richard Shea

    Richard Shea Guest

    Hi - First of all I hope I'm in the right place for some DocBook (XML)
    help.

    I'm looking for help in creating a heirarchical numbering of "things"
    - I say "things" because I'm not quite sure what DocBook element I
    should be using. If it were not for the numbering I would definetly
    say sections as they seem the most natural sub-division of my
    "article" - however I'm open to suggestions.

    What I want to produce should look something like this ...

    Title of my section numbering example

    This is an introductory paragraph.
    1. Vegetables
    some text about vegetables ...
    1.1 Spring Vegetables
    some text about spring vegetables adsfas ...
    1.1.1 European Spring Vegetables
    some text about European Spring Vegetables adsfas ...
    1.1.2 North American Spring Vegetables
    some text about item 1/2 adsfas ...
    1.2 Winter Vegetables
    some text about Winter Vegetables ...
    2. Fruit
    2.1 Bush Fruits
    some text about bush fruits
    2.2 Tree Fruits
    some text Tree Fruits ..

    .... what I have tried is shown below. Although I have used
    OrderedLists I am not committed to doing it that way - I would prefer
    just to tell the sections to number themselves but I can't figure out
    how to. Any help would be appreciated.



    Example starts below :

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet href="file://localhost/D:/bin/installed/XMLMorphonEditor/Examples/docbook/docbook.css"
    type="text/css"?>
    <!DOCTYPE article SYSTEM
    "file://localhost/D:/bin/installed/XMLMorphonEditor/Examples/docbook/dtd/docbookx.dtd">
    <article>
    <abstract>
    <para></para>
    </abstract>
    <section>
    <title>Title of my section numbering example</title>
    <para>This is an introductory paragraph.</para>
    <orderedlist continuation="continues" inheritnum="inherit"
    numeration="arabic">
    <listitem>
    <para>Vegetables<orderedlist continuation="continues"
    inheritnum="inherit" numeration="arabic">
    <listitem>
    <para>Spring Vegetables<orderedlist
    continuation="continues" inheritnum="inherit" numeration="arabic">
    <listitem>
    <para>European Spring Vegetables</para>
    </listitem>
    <listitem>
    <para>North American Spring Vegetables</para>
    </listitem>
    </orderedlist></para>
    </listitem>
    <listitem>
    <para>Winter Vegetables</para>
    </listitem>
    <listitem>
    <para>Fruit<orderedlist continuation="continues"
    inheritnum="inherit" numeration="arabic">
    <listitem>
    <para>Bush Fruits</para>
    </listitem>
    <listitem>
    <para>Spring Fruits</para>
    </listitem>
    </orderedlist></para>
    </listitem>
    </orderedlist>Vegetables</para>
    </listitem>
    <listitem>
    <para>Fruit<orderedlist continuation="continues"
    inheritnum="inherit" numeration="arabic">
    <listitem>
    <para>Bush Fruits</para>
    </listitem>
    <listitem>
    <para>Spring Fruits</para>
    </listitem>
    </orderedlist></para>
    </listitem>
    </orderedlist>
    </section>
    </article>
    Richard Shea, Jan 13, 2004
    #1
    1. Advertising

  2. Richard Shea

    Don Adams Guest


    >If it were not for the numbering I would definetly
    >say sections as they seem the most natural sub-division of my
    >"article" - however I'm open to suggestions.


    I would stick with nested <section> elements.
    Here is what we do for our documentation with numbered
    headings. We would use the following for your example:

    <article>
    <title>Title of my section numbering example</title>
    <para>This is an introductory paragraph.</para>
    <section>
    <title>Vegetables</title>
    <para>some text about vegetables</para>
    <section>
    <title>Spring Vegetables</title>
    <para>some text about spring vegetables adsfas</para>
    <section>
    <title>European Spring Vegetables</title>
    <para>some text about European Spring Vegetables adsfas</para>
    </section>
    <section>
    <title>North American Spring Vegetables</title>
    <para>some text about 1/2 adsfas</para>
    </section>
    </section>
    <section>
    <title>Winter Vegetables</title>
    <para>some text about Winter Vegetables adsfas</para>
    </section>
    </section>
    <section>
    <title>Fruit</title>
    <para>some text about fruit</para>
    <section>
    <title>Bush Fruits</title>
    <para>some text about bush fruits adsfas</para>
    </section>
    <section>
    <title>Tree Fruits</title>
    <para>some text about tree fruits adsfas</para>
    </section>
    </section>
    </article>

    Then, the stylesheet determines how the <title> text should
    be numbered. For example, if there is a <section> nested
    inside of a <section>, the <title> text for the parent <section>
    would be numbered 1 and the <title> text for the child <section>
    would be numbered 1.1

    --
    Don Adams
    Don Adams, Jan 13, 2004
    #2
    1. Advertising

  3. Richard Shea

    Richard Shea Guest

    Hi Don - Thanks for your advice ...

    "Don Adams" <> wrote in message news:<bu12r8$mg4id$>...
    > >If it were not for the numbering I would definetly
    > >say sections as they seem the most natural sub-division of my
    > >"article" - however I'm open to suggestions.

    [snip]
    >
    > Then, the stylesheet determines how the <title> text should
    > be numbered. For example, if there is a <section> nested
    > inside of a <section>, the <title> text for the parent <section>
    > would be numbered 1 and the <title> text for the child <section>
    > would be numbered 1.1


    .... I had tried something a little like this but instead of getting

    1. Vegetables
    1.1 Winter Vegetables
    1.2 Spring Vegetables

    .... I got ..

    1. Vegetables
    1. Winter Vegetables
    2. Spring Vegetables

    .... would you be able to post a style sheet which produces the
    heirarchical numbering using the nested sections you have suggested ?
    If it were possible I'd appreciate it.

    regards

    richard shea.
    Richard Shea, Jan 13, 2004
    #3
  4. Richard Shea

    Don Adams Guest

    > ... would you be able to post a style sheet which produces the
    > heirarchical numbering using the nested sections you have suggested ?
    > If it were possible I'd appreciate it.


    Unfortunately, I can't provide an example at this time. Right now we use
    FrameMaker 7 to apply the style and print. Anything I showed you wouldn't
    apply to anything but a FrameMaker 7 stylesheet (called an EDD).

    I know other groups have done the same thing
    with numbered headings, so it is possible. You'll need to
    re-post this as a stylesheet question that asks how to control
    the numbering of titles in nested sections.

    --
    Don
    Don Adams, Jan 13, 2004
    #4
  5. On 12 Jan 2004 18:15:11 -0800, Richard Shea <>
    wrote:

    > Hi - First of all I hope I'm in the right place for some DocBook
    > (XML) help.


    While there are probably people reading this newsgroup that can answer
    your questions, you might want to subscribe to the DocBook mailing
    lists:

    http://www.docbook.org/mailinglist/index.html

    > What I want to produce should look something like this ...
    >
    > Title of my section numbering example
    >
    > This is an introductory paragraph.
    > 1. Vegetables
    > some text about vegetables ...
    > 1.1 Spring Vegetables
    > some text about spring vegetables adsfas ...
    > 1.1.1 European Spring Vegetables
    > some text about European Spring Vegetables adsfas ...
    > 1.1.2 North American Spring Vegetables
    > some text about item 1/2 adsfas ...
    > 1.2 Winter Vegetables
    > some text about Winter Vegetables ...
    > 2. Fruit
    > 2.1 Bush Fruits
    > some text about bush fruits
    > 2.2 Tree Fruits
    > some text Tree Fruits ..


    I think another poster suggested using nested <section>s, but you
    commented that you couldn't get the numbering as above. Indeed,
    <section>s seem right for what you have above, and you want the
    following paramter in your customisation layer:

    <xsl:param name="section.label.includes.component.label" select="1"/>


    --
    Paul.

    mailto:paulh_logicsquad_net (make the obvious substitutions)
    Paul A. Hoadley, Jan 14, 2004
    #5
  6. Richard Shea

    Richard Shea Guest

    > Unfortunately, I can't provide an example at this time. Right now we use
    > FrameMaker 7 to apply the style and print. Anything I showed you wouldn't
    > apply to anything but a FrameMaker 7 stylesheet (called an EDD).
    >

    OK thanks anyway for your advice, I appreciate it.

    regards

    richard
    Richard Shea, Jan 15, 2004
    #6
  7. Richard Shea

    Richard Shea Guest

    "Paul A. Hoadley" <paulh_logicsquad_net> wrote in message news:<>...
    > On 12 Jan 2004 18:15:11 -0800, Richard Shea <>
    > wrote:
    >
    > > Hi - First of all I hope I'm in the right place for some DocBook
    > > (XML) help.

    >
    > While there are probably people reading this newsgroup that can answer
    > your questions, you might want to subscribe to the DocBook mailing
    > lists:
    >
    > http://www.docbook.org/mailinglist/index.html


    thanks for that, I've just subscribed.

    [snip]
    >
    > I think another poster suggested using nested <section>s, but you
    > commented that you couldn't get the numbering as above. Indeed,
    > <section>s seem right for what you have above, and you want the
    > following paramter in your customisation layer:
    >
    > <xsl:param name="section.label.includes.component.label" select="1"/>


    OK thanks. I think what the last two days have taught me is that I
    don't know as much as I thought I did ! The term 'customisation layer'
    is a new one so I'll have to do some more reading but once I've
    figured that out I will apply your advice, thank you.

    regards

    richard.
    Richard Shea, Jan 15, 2004
    #7
  8. Hi Richard,

    On 14 Jan 2004 16:22:00 -0800, Richard Shea <>
    wrote:

    > OK thanks. I think what the last two days have taught me is that I
    > don't know as much as I thought I did ! The term 'customisation
    > layer' is a new one so I'll have to do some more reading but once
    > I've figured that out I will apply your advice, thank you.


    Sorry, I could have been more clear---I thought you were already using
    your own customisation layer. The concept is straightforward: you
    create a (usually small) XSL stylesheet of your own which contains
    anything you want to override in the main stylesheets. In this custom
    stylesheet, you 'import' the main stylesheet (docbook.xsl), but
    anything you re-define takes precedence. If you're not at this stage
    yet, you probably haven't seen Bob Stayton's comprehensive text book,
    available in print as well as online here:

    http://www.sagehill.net/docbookxsl/index.html


    --
    Paul.

    mailto:paulh_logicsquad_net (make the obvious substitutions)
    Paul A. Hoadley, Jan 16, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Antonio Amato
    Replies:
    2
    Views:
    1,268
    Michael Wiedmann
    Nov 18, 2004
  2. Michael Doubez
    Replies:
    1
    Views:
    528
    Peter Flynn
    Jan 27, 2007
  3. Raman
    Replies:
    6
    Views:
    4,719
    santosh
    Aug 3, 2007
  4. Replies:
    1
    Views:
    522
    Joseph Kesselman
    Nov 27, 2007
  5. Geoff Cox

    a numbering question

    Geoff Cox, May 4, 2005, in forum: Perl Misc
    Replies:
    6
    Views:
    89
    Geoff Cox
    May 4, 2005
Loading...

Share This Page