XSLTC creates namespace nodes when it could re-use existing ones in scope. --------------------------------------------------------------------------
Key: XALANJ-2411 URL: https://issues.apache.org/jira/browse/XALANJ-2411 Project: XalanJ2 Issue Type: Bug Affects Versions: The Latest Development Code, 2.7.1 Reporter: Brian Minchau Assignee: Brian Minchau XSLTC creates extra namespace nodes, mapping ns0, ns1 ... to URIs when an existing namespace mapping is in scope and its prefix could be used (or the default namespace could be used). Here is a stylesheet showing the problem: <?xml version="1.0" encoding="UTF-8"?> <!-- bug.xsl --> <xsl:stylesheet version="1.0" xmlns="http://uri1" xmlns:prfx2='http://uri2' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <out2> <xsl:call-template name="makeElement1"> <xsl:with-param name="tagName" select="'elemName1'" /> </xsl:call-template> <xsl:call-template name="makeElement2"> <xsl:with-param name="tagName" select="'elemName2'" /> </xsl:call-template> <xsl:call-template name="makeElement3"> <xsl:with-param name="tagName" select="'elemName3'" /> </xsl:call-template> </out2> </xsl:template> <xsl:template name="makeElement1"> <xsl:param name="tagName"/> <xsl:element name="{$tagName}" namespace='http://uri1'/> </xsl:template> <xsl:template name="makeElement2"> <xsl:param name="tagName"/> <xsl:element name="{$tagName}" namespace='http://uri2'/> </xsl:template> <xsl:template name="makeElement3"> <xsl:param name="tagName"/> <xsl:element name="{$tagName}" namespace='http://uri3'/> </xsl:template> </xsl:stylesheet> When run with any XML input, or this one, bug.xml: <?xml version="1.0" encoding="UTF-8"?><doc/> Using say the process command: java org.apache.xalan.xslt.Process -XSLTC -IN bug.xml -XSL bug.xsl The output is this: <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1"> <ns0:elemName1 xmlns:ns0="http://uri1"/> <ns1:elemName2 xmlns:ns1="http://uri2"/> <ns2:elemName3 xmlns:ns2="http://uri3"/> </out2> The output should be: <?xml version="1.0" encoding="UTF-8"?><out2 xmlns:prfx2="http://uri2" xmlns="http://uri1"> <elemName1/> <elemName2 xmlns="http://uri2"/> <elemName3 xmlns="http://uri3"/> </out2> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]