Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document How to Use Your Own Stylesheets #403

Closed
6 tasks
tomschr opened this issue Mar 29, 2017 · 0 comments
Closed
6 tasks

Document How to Use Your Own Stylesheets #403

tomschr opened this issue Mar 29, 2017 · 0 comments
Assignees

Comments

@tomschr
Copy link
Collaborator

tomschr commented Mar 29, 2017

Problem

Currently, we don't have a dedicated section which deals about how to use your own XSLT stylesheets for your project.
Although we have 9.3 Customizing the DocBook Stylesheets, but this doesn't give readers instructions. It only links to my DoCookBook project.

Solution

I would recommend to enhance section 9.3 Customizing the DocBook Stylesheets (ID=sec.daps.user.layout.styleheets) with the following information:

  • Reasons to use a customization layer
    Why does someone want this? Well, it's the usual suspects: change the original DocBook XSL stylesheet output, adapt the behaviour how an element is processed, need for a corporate style, etc.

  • Correct (sub)structure for your customization stylesheets
    It's probably a good idea to use xslt insde your project as the top-level root directory for all the stylesheets (although this is just a recommendation and not mandatory) . Depending on which formats are supported, this top-level directory should/could be integrated into your project directory like this:

YOUR_DOC_DIR/
 |
 +-- DC-files
 +-- xml/
      +--- your XML files...
 +-- xslt/
      +-- fo/
           +-- docbook.xsl
      +-- html/
           +-- docbook.xsl
           +-- chunk.xsl
       +-- [additional formats, supported by DB XSL]
           +-- docbook.xsl
  • Your XSLT customization layer
    Use Example 2.1. General Customization Layer as a basis. The main entry file has to be named docbook.xsl. For HTML or XHTML, you need an additional chunk.xsl file which is needed for "chunking" (splitting the result transformation into different HTML files).
    It is allowed (and recommended!) to split the stylesheets into different sub-stylesheets which are included/imported into the main entry file.

  • DC file(s) changes
    The DC file must include the STYLEROOT variable, pointing to the xslt directory (see above). It is recommended to set also the FALLBACK_STYLEROOT variable. For openSUSE, it points to /usr/share/xml/docbook/stylesheet/nwalsh.

  • Include references
    Add references to the DocBook XSL Stylesheets: Reference Documentation and my DoCookBook project.

  • XSLT knowledge needed
    The reader should be aware of that he or she needs to know about XSLT (at least a little bit). Basic customizations like parameter changes can be done by simple adding a line with <xsl:param name="PARAMETER_NAME" select="VALUE"/>. The available parameters are format dependent and are listed in the "XSL Stylesheets Reference Documentation".

Recommendations

  • Use a <procedure> tag to give the reader instructions on how to setup his project to support his own stylesheets.
  • It's probably easier to explain it with an example instead of being abstract.

In the long run this maybe a topic for a Developer Guide, but for the time being I think we should document it in the User Guide.

fsundermeyer added a commit that referenced this issue Jun 14, 2017
Stable release DAPS 2.4.0:

* New Features:
  - added a dependency checker for DAPS (/usr/bin/daps-check-deps)
    that makes it easy to check for missing programs/packages
  - added a "--lean" parameter to PDF generation for creating PDFs
    with a reduced file size (by reducing the quality of included
    images); useful for sharing PDFs via e-mail
  - added a srylesheet for returning all IDs from an XML file
    (daps-xslt/common/get-all-xmlids.xsl)

* Bugfixes:
  - #408: The list-file-* commands now work with ROOTIDs from all
          possible elements
  - #390: When an ID appears twice in the XML and this ID is used
          with --rootid, DAPS's error message is unhelpful
  - #365: Improved error messages on "File not found" errors
          (now tells whether the path was provided by command-line
           or config file)
  - #371: Make path to the xmlformat config file configurable
  - #372: Adjusted debian dependency list
  - #373: Check unpack-locdrop
  - #379: Output error of list-images-multisrc with
          pretty | wc option
  - #380: Proper error messages when binaries/packages are missing
  - #392: daps-xmlformat writes name of config file into output
  - SVGs were not included in ePUBs
    (https://bugzilla.suse.com/show_bug.cgi?id=1006204)
  - Setting a default value for db5_version in configure.ac
    otherwise the DB5 URN in etc/config will be set to an invalid
    value if DB5 is not installed when running make
  - fixed a few minor issues with the config file parser that was
    introduced with 2.3.0 (among them #387)
  - Increased Java stacksize for jing
  - Improved the DocBook5 -> DocBook 4 (-> NovDoc) conversion
  - compatibility: Debian's version of "which" does not support
    long parameters

* Documentation:
  - Various updates to reflect changes in the code
  - #345: added documentatioon for the xmlformat subcommand
  - #362: added documentation for the --jobs option
  - #363: added documentation about building a bigfile from
          invalid sources
  - #364: added documentation for the --norefchecks option
  - #403: improved documentation about stylesheet customizing
          (also see #407)
  - #404: clarify doc about listing unused images
  - completely revised the doc (spelling, language and grammar)
  - doc is not yet 100% on par with the code, but we are getting
    closer

* Compatibility:
  - successfully tested DAPS on Linux Mint 18.1
fsundermeyer added a commit that referenced this issue Jun 14, 2017
Stable release DAPS 2.4.0:

* New Features:
  - added a dependency checker for DAPS (/usr/bin/daps-check-deps)
    that makes it easy to check for missing programs/packages
  - added a "--lean" parameter to PDF generation for creating PDFs
    with a reduced file size (by reducing the quality of included
    images); useful for sharing PDFs via e-mail
  - added a srylesheet for returning all IDs from an XML file
    (daps-xslt/common/get-all-xmlids.xsl)

* Bugfixes:
  - #408: The list-file-* commands now work with ROOTIDs from all
          possible elements
  - #390: When an ID appears twice in the XML and this ID is used
          with --rootid, DAPS's error message is unhelpful
  - #365: Improved error messages on "File not found" errors
          (now tells whether the path was provided by command-line
           or config file)
  - #371: Make path to the xmlformat config file configurable
  - #372: Adjusted debian dependency list
  - #373: Check unpack-locdrop
  - #379: Output error of list-images-multisrc with
          pretty | wc option
  - #380: Proper error messages when binaries/packages are missing
  - #392: daps-xmlformat writes name of config file into output
  - SVGs were not included in ePUBs
    (https://bugzilla.suse.com/show_bug.cgi?id=1006204)
  - Setting a default value for db5_version in configure.ac
    otherwise the DB5 URN in etc/config will be set to an invalid
    value if DB5 is not installed when running make
  - fixed a few minor issues with the config file parser that was
    introduced with 2.3.0 (among them #387)
  - Increased Java stacksize for jing
  - Improved the DocBook5 -> DocBook 4 (-> NovDoc) conversion
  - compatibility: Debian's version of "which" does not support
    long parameters

* Documentation:
  - Various updates to reflect changes in the code
  - #345: added documentatioon for the xmlformat subcommand
  - #362: added documentation for the --jobs option
  - #363: added documentation about building a bigfile from
          invalid sources
  - #364: added documentation for the --norefchecks option
  - #403: improved documentation about stylesheet customizing
          (also see #407)
  - #404: clarify doc about listing unused images
  - completely revised the doc (spelling, language and grammar)
  - doc is not yet 100% on par with the code, but we are getting
    closer

* Compatibility:
  - successfully tested DAPS on Linux Mint 18.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants