OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook-apps] overriding a template used in a 'mode'

Hi Tim,
While attribute-sets merge in XSL, templates do not.  If you replace that template 
with a cut-down version, it will be applied in all cases because of match="*", and the 
original template will never be used because yours has a higher priority.

Since the template is written using a mode, you could write a new template that 
matches on d:chapter in that mode, and one for d:section too. Then the new template 
will apply on the to the elements they match, and the original match="*" template will 
apply only to any other elements.  Your templates will need to accept the same 
template parameters and return a similar value.

Generally using a mode is most useful when you have more than one template and they 
match on different elements.  This is not a good use of a mode, because there is only 
one template that matches on all elements, and then the xsl:choose part handles the 
different elements.  The template could have been written as a named template. But it 
is good that it wasn't because with a mode you have the opportunity to customize per 
element by adding templates with more specific matches, without having to change the 

Bob Stayton
Sagehill Enterprises

----- Original Message ----- 
From: "Tim Arnold" <jtim.arnold@gmail.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, June 01, 2011 11:52 AM
Subject: [docbook-apps] overriding a template used in a 'mode'

> hi,
> I would like to override part of the chunking xsl stylesheet.
> What I've done so far is copy the entire template so it begins as follows:
> <xsl:template match="*" mode="recursive-chunk-filename" priority="1">
> and I change on the two parts I want to be different--the chapter and
> the section:
> <xsl:when test="self::d:chapter">
>   chapter filename stuff
>  </xsl:when>
> ...
> <xsl:when test="self::d:section">
>   section filename stuff
>  </xsl:when>
> So my question is whether I really need to copy the whole template or
> is it possible to override the original template with a template that
> matches just the parts I want to change.
> I think the part about this being used in a 'mode' is the part that confuses me.
> thanks,
> --Tim Arnold
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]