docbook v5 customization layer - indent 1st paragraph line

osprofi
Posts: 18

docbook v5 customization layer - indent 1st paragraph line

Mon Mar 25, 2013 5:50 pm

Hello DocBook users
I am trying to introduce a customization layer for docbook v5 to indent the 1st paragraph line.
Normally, by re-defining normal.para.spacing attribute set in the customization layer this is possible:

Code: Select all

<xsl:attribute-set name="normal.para.spacing">
  <xsl:attribute name="text-indent">24pt</xsl:attribute>
</xsl:attribute-set>


How and where this code should be introduced in the docbook v5 xsl ?

Thanks very much for your assistance

regards, Peter
sorin_ristache
Posts: 4144

Re: docbook v5 customization layer - indent 1st paragraph line

Mon Mar 25, 2013 6:51 pm

Hello Peter,

The attribute set normal.para.spacing is defined in the various param.xsl stylesheets from Docbook XSL used for generating output formats like PDF and XHTML. These stylesheets are located in directory [Oxygen-install-dir]\frameworks\docbook\xsl, for example the stylesheets for the PDF output are located in the fo subdirectory of this directory, the stylesheets for the XHTML output are located in the xhtml subdirectory, etc. You just have to add the attribute called text-indent in this set, for example:

Code: Select all

<xsl:attribute-set name="normal.para.spacing">
  <xsl:attribute name="text-indent">24pt</xsl:attribute>
  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>


The steps for creating and applying a Docbook customization layer in Oxygen are explained in a video demonstration on the video demo page of the Oxygen website. Please let us know if the process outlined there is not clear / helpful enough.


Regards,
Sorin
osprofi
Posts: 18

Re: docbook v5 customization layer - indent 1st paragraph line

Mon Mar 25, 2013 7:16 pm

Hello Sorin
thanks for quick reply
Your idea was also mine but this does not work, see the xsl file:

Code: Select all

<?xml version='1.0'?>
<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="xhtml/docbook.xsl"/>
<xsl:attribute-set name="normal.para.spacing">
  <xsl:attribute name="text-indent">24pt</xsl:attribute>
  <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
  <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
  <xsl:attribute name="space-before.maximum">1.2em</xsl:attribute>
</xsl:attribute-set>
</xsl:stylesheet>

- the html subdir does not contain the docbook.xsl
- the xhtml transformation in Oxygenxml transforms OK but does not show the transformed file
- the customization layer for docbook v5 is described here http://www.docbook.org/tdg51/en/html/ch05.html fully differently.

- do you have any idea what I have to change here ?

best regards, peter
sorin_ristache
Posts: 4144

Re: docbook v5 customization layer - indent 1st paragraph line

Tue Mar 26, 2013 2:07 pm

Hi Peter,

The location where you save your new XSLT stylesheet (your customization layer) is very important for resolving the relative path in your import element:

Code: Select all

<xsl:import href="xhtml/docbook.xsl"/>


For the above import element to work you have to place your stylesheet in the [Oxygen-install-dir]/frameworks/docbook/xsl directory.

Please follow the example of the XSLT stylesheet from the built-in Oxygen scenario called DocBook XHTML, that is [Oxygen-install-dir]/frameworks/docbook/xsl/xhtml/docbook_custom.xsl. It imports (indirectly) the same docbook.xsl stylesheet and it works, but it is located in the [Oxygen-install-dir]/frameworks/docbook/xsl/xhtml/docbook_custom.xsl directory, otherwise the relative paths for the imported stylesheets would not work.

You should validate your XSLT customization layer stylesheet with the Validate action (with the shortcut Ctrl+Shift+V) available on the toolbar and also on the menu Document -> Validate. Usually fixing all validation errors prevents any transformation errors.


Regards,
Sorin

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests