xsl-list
[Top] [All Lists]

[xsl] xsl:import overriding template rules

2011-03-21 08:22:03
Hello,

In my xsl stylesheets I use the xsl:import element a lot. The templates in the 
imported xsl files can be overridden by the templates in the xsl file which 
does the import. So far everything goes fine.
I was assuming that this overriding rule, applies to templates with an equal 
matching pattern.

An example:
file aa.xsl
file bb.xsl

some templates of file aa.xsl are:

<xsl:template match='*'>
        <root>
                <xsl:apply-templates match='elementA'/>
        </root>
</xsl:template>

<xsl:template match='*[local-name() = "SpecificElement"]'>
        <xsl:element name='{name()}'>
                <xsl:apply-templates match='@* | comment() | text()'/>
        </xsl:element>
</xsl:template>

file bb.xsl
This file imports file aa.xsl

<xsl:import href='aa.xsl'/>

<xsl:template match='*'>
        <root>
                <xsl:template match='elementB'/>
        </root>
</xsl:template>


xsl:template match='*'  in file bb.xsl, overrides the xsl:template match='*' in 
file aa.xsl. This is what I want and suspected.
But.... it overrides also the xsl:template match='*[local-name() = 
"SpecificElement"]' in file aa.xsl. This is what I was not suspecting and also 
don't want.

My question is, is it correct that the template xsl:template 
match='*[local-name() = "SpecificElement"]' in file aa.xsl, is overridden by 
the template match='*' if file bb.xsl.

Regards,
Boudewijn


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