Page 1 of 1
Docbook v5 article: customization layer section title
Posted: Mon Mar 25, 2013 9:55 pm
by HelenM
Hi everyone.
I am a newbie to DocBook and XSL and I am trying to customise the stylesheets. I have a small DocBook article and I don't want to display the section title. It seems that an article has to be made up of one section and so I guess that this section has to have a title, but I don't want it to be shown in the pdf. Can anyone give me any pointers on how I can hide it?
Thanks in advance for your help.
Re: Docbook v5 article: customization layer section title
Posted: Tue Mar 26, 2013 1:44 pm
by sorin_ristache
Hi,
I suppose you want to keep the article title but don't want to display any section title in the transformation output. In this case you could create a document with a
section or
sect1 root element instead of
article so that you have only one title in the document. The
section/
sect1 title would contain exactly what you have now as the
article title. You just transform the
section or
sect1 document to PDF, no customization of the Docbook stylesheets is needed, all you have to do is create a document with only one title.
If you need to keep both the article title and the section title but remove the section title only from the transformation output then you should create a customization of the Docbook PDF transformation. You can create a new XSLT stylesheet that imports and extends
[Oxygen-install-dir]/frameworks/docbook/xsl/fo/docbook_custom.xsl and add the following XSLT template in the new XSLT stylesheet that will override the default one from the imported stylesheet:
Code: Select all
<xsl:template name="section.heading"/>
The customization process is explained in a
video tutorial on our
video demo page. Please let us know if your customized Docbook PDF transformation does not run or if you need further help.
Regards,
Sorin
Re: Docbook v5 article: customization layer section title
Posted: Tue Mar 26, 2013 7:41 pm
by HelenM
Hi Sorin
Thank you so much for this info! I went for the second option and it worked perfectly. Extremely grateful for your help.
Best wishes,
Helen
Re: Docbook v5 article: customization layer section title
Posted: Wed Jun 26, 2013 4:39 pm
by HelenM
Hi
Following on from this, I now have my sect1 titles hidden, but have added a sect2 and would like to display that title. How can I edit this parameter
Code: Select all
<xsl:template name="section.heading"/>
in my customisation layer to achieve that?
Thank you very much.
Best wishes,
Helen
Re: Docbook v5 article: customization layer section title
Posted: Thu Jun 27, 2013 12:25 pm
by sorin_ristache
Hi Helen,
The template that you have to customize in your
Docbook customization layer is located in the stylesheet
[Oxygen-install-dir]\frameworks\docbook\xsl\xhtml\sections.xsl and is this:
Code: Select all
<xsl:template name="section.heading">
This template has a parameter called
level so inside that template you have to do the normal processing only if
$level = 2.
Regards,
Sorin