xsl-list
[Top] [All Lists]

RE: superfluous namespace declarations with xsl:element

2002-12-10 07:25:08
How can I avoid, that with <xsl:element name="{name()}"> and 
a namespace-prefix in this name, I get a namespace 
declaration in my output on mostly all elements created this 
way? Is there some strategy, to get the namespace declaration 
only once in my root element?

Transformers work quite differently on this point (eg. msxslt 
apparently avoids itself superfluous declarations), so I'm 
wondering if there is a general approach at all.

Most XSLT processors will avoid outputting redundant namespace
declarations, but there is no way of forcing them to do so.

What processor are you using and what output are you getting?

Why are you using <xsl:element name="{name()}"> rather than <xsl:copy>?
There is an important difference: xsl:copy puts the new element in the
same namespace as the original, whereas <xsl:element name="{name()}">
looks for a namespace declaration in the stylesheet that has the same
namespace prefix as the original name in the source document.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>