xsl-list
[Top] [All Lists]

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

2010-10-15 02:49:19
Dear Wendell,

thank you for your kindly reply.

El jue, 14-10-2010 a las 10:57 -0400, Wendell Piez escribió:
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>

-- 
Néstor Amigo Cairo -- www.aberi.org -- +34 687 967 481 (lu-vi, 9-13h)
Presidente de la Asociación por la Libertad de la Información


--~------------------------------------------------------------------
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>