Subject: Re: Customizing DocBook numbering scheme using XSL (legal style)
From: Néstor Amigo Cairo <nestor@xxxxxxxxx>
Date: Fri, 15 Oct 2010 09:49:00 +0200
|
Dear Wendell,
thank you for your kindly reply.
El jue, 14-10-2010 a las 10:57 -0400, Wendell Piez escribiC3:
> Dear Nestor,
>
> There are a couple of things about your question that are confusing.
>
> You are correct that you cannot parameterize the setting on xsl:number/@level.
>
> But you also say
>
> >But I am stuck because I cannot change the element <xsl:number> without
> >having to rewrite a new template from scratch.
>
> without explaining why this is a problem.
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.
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.
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, 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).
Also, the problem is that I use <xsl:template match="sect1">, and that
code renders all the standard stylesheet's definition of sect1 useless.
> The usual approach to customizing code (such as
> the Docbook stylesheets you might download) is
> indeed to write new templates, keeping them in a
> separate layer that imports the generic logic,
> overriding its templates selectively. So you
> rewrite only what needs rewriting, while keeping
> your customizations separate from a standard
> distribution. The mechanism you would use is xsl:import.
>
> But it's not clear from your message whether this
> advice is even relevant, since you don't say much
> about what kind of architectural issues you are dealing with.
It would be useful to know what stylesheet I do have to import to
generate a PDF. I'm using dblatex.
> So: what's wrong with rewriting the template? You
> would have to do this anyway even if you could
> parameterize the setting you wanted, since the
> template as given doesn't accept a parameter. :-)
It's okay, if it's so simple, but what template?
(1) code of the template
> > <xsl:template match="sect1">
> > <xsl:number level="any" from="chapter" format="1. "/>
> > <xsl:apply-templates/>
> > </xsl:template>
--
NC)stor Amigo Cairo -- www.aberi.org -- +34 687 967 481 (lu-vi, 9-13h)
Presidente de la AsociaciC3n por la Libertad de la InformaciC3n
|