xsl-list
[Top] [All Lists]

Re: [xsl] minimally overriding functions in XSLT 2.0

2013-01-09 11:31:48
Unfortunately there is no equivalent of super() that allows you to invoke an overridden function from an overriding function.

This omission is being rectified in XSLT 3.0 (but not yet implemented in Saxon).

Michael Kay
Saxonica

On 09/01/2013 16:56, Louis-Dominique Dubeau wrote:
Dear List Members,

I've searched the FAQ and the archive but did not find this specific
topic discussed.

The general issue here is customizing the behavior of stylesheets while
avoiding as much as possible code duplication. The way I typically
customize the behavior of a stylesheet that I should not alter (for
whatever reason) is to create a new stylesheet which imports the base
stylesheet, and then I override what I need.

Minimally overriding the functionality of templates imported from the
base stylesheet is trivial: it amounts to detecting the condition I care
about, producing the right output for this case, and calling
<xsl:apply-imports/> for all cases where the base stylesheet does the
right thing. (And it can be even simpler than this.)

There does not seem to be an equivalent way to achieve this when it
comes to overriding functions. I can override a function defined in the
base stylesheet but there is no mechanism that I can see that would
allow the overriding function to call the overridden function. So I have
to copy most of the overridden function into the overriding function if
I want to preserve functionality for most but not all cases that the
overridden function already handles. So I can override, but not
"minimally".

Maybe there's something I've missed somewhere in the XSLT specs? I
believe the issue is with XSLT 2.0 itself but in case it matters I'm
using teitodocx, which in turn uses Saxon-HE 9.4.0.4J from Saxonica to
do the XSLT processing.

Thank you,
Louis


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>