[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl:import overriding template rules

Subject: xsl:import overriding template rules
From: Boudewijn Bosgoed <bbosgoed@xxxxxxx>
Date: Mon, 21 Mar 2011 14:21:46 +0100
 xsl:import overriding template rules
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.