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

Misunderstanding named initial template and precedence

Subject: Misunderstanding named initial template and precedence rules?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 28 Feb 2007 16:57:50 +0100
 Misunderstanding named initial template and precedence
Hi List,

This struck me as very peculiar today, when I was researching a bug in my xslt templates: calling an initial template does *not* mean that the template with the highest import precedence is called.... This sounds like an implementation bug to me, but I don't have all the spec rules clear, hence I ask you (the list) first.

Two stylesheets:

** IMPORTED **
<xsl:stylesheet version = "2.0"
   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" >

   <xsl:template match="/" name="main" >
       <low-precedence />
   </xsl:template>
</xsl:stylesheet>

** IMPORTING **
<xsl:stylesheet version = "2.0"
   xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" >

<xsl:import href="import.xslt"/>

   <xsl:template match="/" name="main" >
       <high-precedence />
   </xsl:template>
</xsl:stylesheet>


Call this stylesheet with initial template set to "main" and the output is:


<low-precedence />

Expected output is:

<high-precedence />


I wanted to test this behavior with other processors than Saxon that (claim to) be xslt 2 compliant, i.e., AltovaXML, but alas, it does not support the named initial template. I called Saxon like this:


java -jar saxon8.jar -it main importing.xslt


Imho, this behavior is either erroneous, or if not, unwanted, because it does not fit the normal import precedence rules. Am I wrong? Is there a special treatment for import precedence when it comes to a named initial template? Setting priority did not change this behavior (but, afaik, that only applies for equal import precedence).


Cheers,
-- Abel Braaksma

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-2011 All Rights Reserved.