Altova Mailing List Archives
>xsl-list Archive Home
>Thread Prev - [xsl] complex transform vs. generated transform performance..
>Thread Next - Re: [xsl] xsl:call-template , strange behaviour
Re: [xsl] xsl:call-template , strange behaviour
Date: 6/6/2005 5:43:00 AM
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 ======================================================================