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

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Tim Arnold" <[email protected]>
To: <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to