[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Extending XSL stylesheets to match extended DTD
I can give you some general guidelines and hints
for creating a stylesheet customization for new elements.
First, find elements whose format most closely
resembles what you want for output, and copy those to your customization layer,
changing the match= attribute to your new element name, and adding any new steps
you want to the processing.
Most (but not all) templates in DocBook XSL use a
general <xsl:apply-templates/> to process all their children. If you
have a match attribute on a template for a new element in that context, it
will get used in those circumstances.
But there are a few situations where elements are
selected by name, in order to present them in a specific sequence. In
those cases, a new element's template might not get called unless you customize
the calling template to add your element to the list. The worst case of
this kind of processing is the computation of Next and Previous links in chunked
HTML output. See for example the template named "chunk-all-sections" in
html/chunk-code.xsl. Those templates use long lists of element names in select
attributes to figure out the next chunk.
If you want to actually chunk HTML on one of your
new elements, be aware that the stylesheets aren't easy to customize for that
purpose. The previously mentioned Next and Previous computation shows
why. You have to add your element name to several locations to include
it.
Many elements are processed in more than one XSL
mode, so you'll need to also add templates for those modes if appropriate.
For example, if you want an element to appear in the table of contents, you may
need a mode="toc" template. If you want to cross reference to an element,
then you need a mode="xref-to" template. An element with title might
need a mode="title.markup" template.
If any of your new elements is to generate text
labels or titles, then you will want to add gentext elements to the
'local.l10n.xml' parameter (it is a parameter, not an XML file). You might
need to add a general <l:gentext> element, as well as <l:template>
elements in the contexts of title and xref.
Those are some general suggestions. If you
want to select a couple of your new elements and describe how you want them
handled, we could have a more detailed discussion.
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]