RE: [xsl] Misunderstanding named initial template and precedence rules?

Subject: RE: [xsl] Misunderstanding named initial template and precedence rules?
From: "Colin Adams" <colinpauladams@xxxxxxxxxxx>
Date: Wed, 28 Feb 2007 19:36:18 +0000
From: Abel Braaksma <abel.online@xxxxxxxxx>

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:

Then how can it claim to be compliant?


On that basis, I claim 137% compliance with the recommendation for gexslt/gestalt.

What you should have typed was:

gexslt --template=main importing.xsl

in which case you would have seen:

<?xml version="1.0" encoding="UTF-8"?><high-precedence/>

_________________________________________________________________
MSN Hotmail is evolving  check out the new Windows Live Mail http://ideas.live.com


Current Thread