DocBook - numbering sections - newbie question

R

Richard Shea

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>
 
D

Don Adams

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
 
R

Richard Shea

Hi Don - Thanks for your advice ...

Don Adams said:
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.
 
D

Don Adams

... 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.
 
P

Paul A. Hoadley

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"/>
 
R

Richard Shea

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
 
R

Richard Shea

Paul A. Hoadley said:
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.
 
P

Paul A. Hoadley

Hi Richard,

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top