[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Creating "animations" figure subclass
Hi Bob, Thanks for replying so quickly, your knowledge of XSL and in particular, docbook XSL, is quite brilliant. Thanks very much for your help. I added the following template to my customisation layer, which fixes the problem right up. I'll include a link to it for the archives. http://rafb.net/paste/results/ixsFN047.html Kind regards, Aidan On Tue, 14 Dec 2004 11:19:08 -0800, Bob Stayton <bobs@sagehill.net> wrote: > Yeah, there are quite a lot of templates involved in generating titles. But > the one you want is the template with mode 'label.markup'. That is the > template that generates the number label for an element. In > common/labels.xsl, you will find this template which generates the number > for figure and other formal elements: > > <xsl:template match="figure|table|example|procedure" mode="label.markup"> > > Since this is called via an apply-templates in that mode, you can add > another template to your customization layer with a better match in that > mode to output the number you want: > > <xsl:template match="figure[@role='animation']" mode="label.markup"> > > A figure without that role should get the old template. You will want to > customize that template as well because it is counting all figures, and you > want it to not include figures with that role. > > Or you could do a template like this: > > <xsl:template match="figure" mode="label.markup" priority="2"> > > and let it handle both regular figures and those with the role using a > choose statement. > > Bob Stayton > Sagehill Enterprises > DocBook Consulting > bobs@sagehill.net > > ----- Original Message ----- > From: "Aidan Lister" <aidanis@gmail.com> > To: "Bob Stayton" <bobs@sagehill.net>; <docbook-apps@lists.oasis-open.org> > Sent: Monday, December 13, 2004 8:51 PM > Subject: Re: [docbook-apps] Creating "animations" figure subclass > > > Hi List, > > > > Where can I change the behaviour of the counter for my animations > subclass? > > > > For example, if I have <figure> ... </figure> it will be numerated > > "1". If I then have <figure role="animation"> .. </figure> it will be > > numerated "2", though I'd like to make it "1". I suppose I could use > > the label attribute, but this is less desirable. > > > > In xhtml/formal.xsl I see: > > <xsl:template name="formal.object.heading"> > > ... > > <xsl:apply-templates select="$object" mode="object.title.markup"> > > > > The title ("Figure 1. Some figure") is retrieved there, following > > further I find: > > > > <xsl:when test="$candidate = 'n'"> in gentext.xsl. > > > > This then calls > > > > <xsl:apply-templates select="." mode="insert.label.markup"> > > > > However that's where I lose it, as this template is only defined in > > xref.xsl and has nothing to do with incrementing a variable (or > > calling position()) > > > > Any help appreciated. > > > > Regards, > > Aidan > > > > > > > > On Thu, 9 Dec 2004 00:18:30 +1100, Aidan Lister <aidanis@gmail.com> wrote: > > > Ahh, excellent, I lost it at: > > > > > > <xsl:template match="*" mode="object.title.markup"> in > common/gentext.xsl > > > > > > I created a template as follows: > > > > > > <xsl:template match="figure[@role='animation']" > mode="object.title.template"> > > > <xsl:call-template name="gentext.template"> > > > <xsl:with-param name="context" select="'title'"/> > > > <xsl:with-param name="name">animation</xsl:with-param> > > > </xsl:call-template> > > > </xsl:template> > > > > > > It works perfectly, thanks for the help. > > > > > > Kind regards, > > > Aidan > > > > > > > > > > > > > > > On Wed, 8 Dec 2004 01:09:43 -0800, Bob Stayton <bobs@sagehill.net> > wrote: > > > > OK. The sequence of templates to output a figure title is: > > > > > > > > <xsl:template match="figure"> in formal.xsl > > > > > > > > which calls: > > > > > > > > <xsl:template name="formal.object"> in formal.xsl > > > > > > > > which calls: > > > > > > > > <xsl:template name="formal.object.heading"/> in formal.xsl > > > > > > > > which does: > > > > > > > > <xsl:apply-templates select="$object" mode="object.title.markup"> > > > > > > > > The template that matches is: > > > > > > > > <xsl:template match="*" mode="object.title.markup"> in > common/gentext.xsl > > > > > > > > That template then does: > > > > > > > > <xsl:apply-templates select="." mode="object.title.template"/> > > > > > > > > The template that matches is: > > > > > > > > <xsl:template match="*" mode="object.title.template"> in > > > > common/gentext.xsl > > > > > > > > That template calls 'gentext.template' to get the template for the > current > > > > element > > > > in the title context. If you want it select a different gentext > template, > > > > you could create a more > > > > specific template match: > > > > > > > > <xsl:template match="figure[@role='animation']" > > > > mode="object.title.template"> > > > > > > > > and customize its behavior. > > > > > > > > > > > > > > > > Bob Stayton > > > > Sagehill Enterprises > > > > DocBook Consulting > > > > bobs@sagehill.net > > > > > > > > ----- Original Message ----- > > > > From: "Aidan Lister" <aidanis@gmail.com> > > > > To: "Bob Stayton" <bobs@sagehill.net>; > <docbook-apps@lists.oasis-open.org> > > > > Sent: Tuesday, December 07, 2004 6:42 PM > > > > Subject: Re: [docbook-apps] Creating "animations" figure subclass > > > > > > > > > Hi Bob, > > > > > > > > > > I feel I've phrased my question horribly, I'll try again. > > > > > > > > > > I've successfully added separate LOT-chunk generation for > animations. > > > > > This works perfectly, everything is as it should be. > > > > > > > > > > However, I can't work out how to set the formal figure title. I.e. > the > > > > > title above each Figure in the article. > > > > > > > > > > Do you understand what I mean now? Sorry for the confusion! > > > > > Aidan > > > > > > > > > > > > > > > On Tue, 7 Dec 2004 18:36:28 -0800, Bob Stayton <bobs@sagehill.net> > wrote: > > > > > > Hi Aiden, > > > > > > OK. But you will notice in the List of Figures that it doesn't > say > > > > "Figure" > > > > > > for each item. In fact, the TOC lines do not use the gentext > templates > > > > > > because they don't contain generated words. > > > > > > > > > > > > The template that is generating those lines in the List of Figures > is: > > > > > > > > > > > > <xsl:template match="figure|table|example|equation|procedure" > > > > mode="toc"> > > > > > > > > > > > > This is in html/autotoc.xsl. It first generates the number label > with: > > > > > > > > > > > > <xsl:apply-templates select="." mode="label.markup"/> > > > > > > > > > > > > Then it inserts the $autotoc.label.separator. Then it does: > > > > > > > > > > > > <xsl:apply-templates select="." mode="titleabbrev.markup"/> > > > > > > > > > > > > Does this help? > > > > > > > > > > > > > > > > > > > > > > > > Bob Stayton > > > > > > Sagehill Enterprises > > > > > > DocBook Consulting > > > > > > bobs@sagehill.net > > > > > > > > > > > > ----- Original Message ----- > > > > > > From: "Aidan Lister" <aidanis@gmail.com> > > > > > > To: "Bob Stayton" <bobs@sagehill.net> > > > > > > Cc: <docbook-apps@lists.oasis-open.org> > > > > > > Sent: Tuesday, December 07, 2004 6:18 PM > > > > > > Subject: Re: [docbook-apps] Creating "animations" figure subclass > > > > > > > > > > > > > Hi Bob, > > > > > > > > > > > > > > Nope, I mean the "Figure %n. %t" formal figure title. I know, > > > > > > > somewhere, the l:template name="figure" template is called to > get that > > > > > > > text, I just don't know where. > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > On Tue, 7 Dec 2004 09:22:08 -0800, Bob Stayton > <bobs@sagehill.net> > > > > wrote: > > > > > > > > Do you mean the title at the top of the list? The lists are > > > > generated > > > > > > by > > > > > > > > the make.lots, template, which calls the list.of.titles > template, > > > > both > > > > > > in > > > > > > > > html/autotoc.xsl. In the list.of.titles template, you'll see > the > > > > choose > > > > > > > > statement to select the gentext key, where it uses keys like > > > > > > > > "ListofFigures". That's where the title comes from. > > > > > > > > > > > > > > > > Bob Stayton > > > > > > > > Sagehill Enterprises > > > > > > > > DocBook Consulting > > > > > > > > bobs@sagehill.net > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > > > > > From: "Aidan Lister" <aidanis@gmail.com> > > > > > > > > To: <docbook-apps@lists.oasis-open.org> > > > > > > > > Sent: Tuesday, December 07, 2004 7:30 AM > > > > > > > > Subject: [docbook-apps] Creating "animations" figure subclass > > > > > > > > > > > > > > > > > Hi list, > > > > > > > > > > > > > > > > > > I have many figures in my document, however some of them are > > > > > > > > > animations. I decided to use <figure role="animation" and > use the > > > > > > > > > customisation layer for the rest. > > > > > > > > > > > > > > > > > > I've successfully added separate LOT-chunk generation, but I > can't > > > > > > > > > work out how to set the title. > > > > > > > > > > > > > > > > > > I've created a new node in the gentext file (en.xml), but I > can't > > > > find > > > > > > > > > any reference to the gentext template with regard to > figures. > > > > > > > > > > > > > > > > > > If someone could tell me which file the gentext template for > > > > figures > > > > > > > > > is called, I'd be much appreciative. > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > Aidan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]