xsl-list
[Top] [All Lists]

Re: [xsl] extend an xslt template defined elsewhere?

2007-10-17 23:23:23
I answered my own question -- apply-imports did run through the
existing definition, apply-templates simply continued processing the
children elements from source xml.

On 10/17/07, Anthony Ettinger <anthony(_at_)chovy(_dot_)com> wrote:
Thanks, works great...but I don't see a difference between
apply-templates and apply-imports (at least  in my context):


file: customization_layer.xslt
    <xsl:import
href="/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl"/>
    <xsl:include href="custom.xsl" />

file: custom.xsl
<xsl:template match="glossentry/glossdef">
    <dd>
        <xsl:if test="@role != ''">
            <xsl:attribute name="class">
                <xsl:value-of select="@role"/>
            </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates /> <!-- or apply-imports works too here? -->
    </dd>
</xsl:template>


Both apply-templates and apply-imports works from within the
custom.xsl  -- could this be a problem?




On 10/17/07, Scott Trenda <Scott(_dot_)Trenda(_at_)oati(_dot_)net> wrote:
<xsl:import href="docbook.xsl"/>
<xsl:template match="orderedlist">
  <xsl:if test="@role = 'html class real code goes here'">
    <xsl:apply-imports/>
  </xsl:if>
</xsl:template>

~ Scott


-----Original Message-----
From: ettinger(_at_)gmail(_dot_)com [mailto:ettinger(_at_)gmail(_dot_)com] 
On Behalf Of
Anthony Ettinger
Sent: Wednesday, October 17, 2007 6:56 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] extend an xslt template defined elsewhere?

I have a 'customization layer' as described in Docbook context for my
XSLT stylesheets....

I'd like to know if there is a way I can extend an existing
xslt:template definition (inheriting all its properties, plus adding
my own).

Basically there is a rather large template defined for orderedlist in
docbook xhtml xslt files, and I'd like to add a simple " if @role =>
convert to @class in html" (pseudo code) without having to copy the
entire template definition.


-- 
Anthony Ettinger
Ph: 408-656-2473
var (bonita, farley) = new Dog;
farley.barks("very loud");
bonita.barks("at strangers");

http://chovy.dyndns.org/resume/
http://utuxia.com/consulting

--~------------------------------------------------------------------
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>
--~--