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

Re: xsl:call-template , strange behaviour

Subject: Re: xsl:call-template , strange behaviour
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 06 Jun 2005 01:31:35 -0400
xsl call template namespace
Mukul,

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 result.

Cheers,
Wendell

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

<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:temp="http://whatever"
                version="2.0">

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

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

 <xsl:template name="test">
   <a/>
 </xsl:template>

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

</xsl:stylesheet>

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.                http://www.mulberrytech.com
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
======================================================================

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.