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

Subject: Re: [xsl] Customizing DocBook numbering scheme using XSL (legal style)
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Oct 2010 10:57:03 -0400
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.


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.

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. :-)

Cheers,
Wendell

At 04:57 AM 10/14/2010, you wrote:
Hello,

I'm using dblatex v. 0.2.12-4 (GNU/Linux Ubuntu Lucid 10.04 64bit).

===

I'm trying to number DocBook document in the 'legal' (lawyer) style, to
say:

1 Chapter one
 Article 1. Article one
 Article 2. Article two
2 Chapter two
 Article 3. Article three (*not* 'one' again)
 Article 4. Article four (*not* 'two' again)

=

**I would just like to change <xsl:number> element to have the attribute
"level=any" on the title of a <section> element.**

===
I have used code from
http://www.dpawson.co.uk/xsl/sect2/N5758.html#d7876e154 (recommended
here, but simplified)

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

I have carefully read the documentation, and I understand how XSL works.
I have tried many different solutions, from different sites, but I have
got no positive results.

I have read on the book that XSL works with parameters, so I have tried
also the following (no positive result):

<xsl:param name="section.number.level">any</xsl:param>

and

<xsl:param name="section.title.number.level">any</xsl:param>

But I am stuck because I cannot change the element <xsl:number> without
having to rewrite a new template from scratch.

Any ideas? Thanks.

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


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
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
======================================================================

Current Thread