xsl-list
[Top] [All Lists]

Re: [xsl] Customizing DocBook numbering scheme using XSL (legal style)

2010-10-15 14:58:51
Dear Nestor,

At 03:49 AM 10/15/2010, you wrote:
this is a problem because:

1) I don't know what stylesheet does dblatex use by default to generate
a PDF document. The documentation is not clear about this.

Ah.

2) This is supposed to be so easy that is just not explained (it's
pretty like having 100 keys to open a door: it's obvious that you need a
key, but it's useful to know which one). The manual only says that you
need a key to open the door.

I am familiar with the problem.

3) I think that now I am doing something like what you say:

# dblatex input.xml -p mystylesheet.xsl -o output.pdf

(input.xml is the DocBook document, mystylesheet.xsl is my customized
stylesheet (quite simple, as it only has the code below(1)) and
output.pdf is the generated PDF)

So far, so good.

So, I have read the documentation really carefully, but I only get fuzzy
advices, which can or cannot be useful (I have little experience with
XSL templates, so I would prefer a simple answer).

Understood. The advice is going to be fuzzy as long as we are guessing. And to get past that point requires doing an analysis of the stylesheets, which as you've discovered can be very daunting if they are complex and not well documented.

Also, the problem is that I use <xsl:template match="sect1">, and that
code renders all the standard stylesheet's definition of sect1 useless.

Actually, without doing the analysis, and without trying, you don't actually know whether you'll step on all the standard stylesheet's handling of sect1, especially if (as is not unlikely) it is doing multiple traversals in different modes, etc.

You can be sure, however, that only one template will match a given node in a given processing context, and if you can identify this template, you can override it. Your own version can simply replicate the parts you want to keep, while changing the parts you want to change.

So I'd start by rewriting the template you believe is the culprit, and going from there.

Certainly, I acknowledge that it's possible that in order to achieve what you want, you may find you have to trace the logic of the stylesheet, which can be fairly arduous. (Good practice though!) Good tools help: it's much easier with an IDE such as oXygen which allows you to work with several modules at once, and even trace the operations of a transformation from template to template.

The bottom line is that building, and even using, these complex "standard" stylesheet distributions is more of an art than is sometimes supposed.

Accordingly, you may find at a certain point that it's actually easier to start from scratch and build up. This may be the case if you have a clean document format, which you control (and for which the standard stylesheets are over-engineered, since they are designed to accommodate much more than you have), and if you have many modifications to make.

So, start by duplicating the template in question and seeing whether that works:

<xsl:template match="sect1">
  <xsl:number level="multiple" from="chapter" format="1. "/>
  <xsl:apply-templates/>
</xsl:template>

Also look into how the xsl:apply-imports instruction works. It probably won't help here, but it is useful to know about.

Cheers,
Wendell



======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>