Altova Mailing List Archives

Re: [xsl] xsl:call-template , strange behaviour

From: Wendell Piez <wapiez@---------------->
Date: 6/6/2005 5:43:00 AM

In your stylesheet, your <a/> and <b/> elements have namespace nodes on 
them for the "temp" namespace, which they have inherited from the 
xsl:stylesheet element.

Since you have not asked that this namespace be excluded, the processor can 
only assume that they are part of the data it should output.

Note that neither <a/> nor <b/> is *in* the temp namespace, so it is 
probably not accurate (or at least it's misleading) to say they are 
"associated with it", even though in the result the namespace declarations 
for temp must appear on <a/> and <b/> -- since there's no other place where 
temp can be declared.

Since temp is not actually used, it should be possible to suppress it by 
using the exclude-namespace-prefixes attribute on xsl:stylesheet. But it 
will be suppressed on both <a/> and <b/> -- the fact that <b/> is generated 
by a template named "temp:test" is a red herring. The behavior isn't 
strange at all -- what would be strange would be if <b/> were placed in a 
different namespace from the one given it by the stylesheet (the null 
namespace), just because of the name of the template that adds it to the 


At 12:01 AM 6/6/2005, you wrote:
I have written this stylesheet -

<?xml version="1.0"?>

 <xsl:output method="xml" indent="yes" />

 <xsl:template match="/">
    <xsl:call-template name="test" />
    <xsl:call-template name="temp:test" />

 <xsl:template name="test">

 <xsl:template name="temp:test">


With both Xalan-J 2.6 and Saxon 8.4, I get the output
<?xml version="1.0" encoding="utf-8"?>
<a xmlns:temp="http://whatever"/>
<b xmlns:temp="http://whatever"/>

I am curious, why element <a> gets associated with the
namespace 'temp' ..?

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.