JAXP: XSLTC transformer swallows empty namespace declaration which is necessary to undeclare default namespace

Daniel Fuchs daniel.fuchs at oracle.com
Tue Jul 26 13:47:23 UTC 2016

Hi Christoph, Joe,

Actually what I see with the latest dev version of
JDK 9 (eng. build built a few minutes ago) is this:

<?xml version="1.0" encoding="UTF-8"?><root xmlns="ns1" 

Notice that xmlns="ns1" appears twice in the root element.

So maybe there's more than one bug here :-(


-- daniel

On 26/07/16 12:56, Langer, Christoph wrote:
> Hi Joe,
> thanks for looking at this.
> Here is my comments:
>> I'm not sure why empty namespace was explicitly excluded. But for the
>> 2nd part, the developer was clear with a note on the intention. You may
>> want to try removing the condition statement that excluded the empty
>> namespace, but keep the 2nd part as is, and then run the tests to see if
>> there's any issue or a reason why it was excluded.
> You are right, the comment for the second part is quite explicit. However, the method declaresDefaultNS() of XslElement always returns false and the comment to it says: "This method is now deprecated. The new implemation of this class never declares the default NS". As I didn't find any other class in the hierarchy overwriting this method, I decided to remove it and to cleanup code. Are you ok with that or is it illegal here?
>> On another thought, if the following workaround works for you, we may as
>> well leave the current implementation as is:
>> try replacing <test xmlns=""/> in the above, with <xsl:element
>> name=\"test\" namespace=\"\" />"
> This might work, however, the customer wants to change his current XML toolkit to the JDK one and expects his existing XML/XSL code to work as is. So that's no option.
> I'll go open a bug for that now and prepare a real review.
> Best regards
> Christoph

More information about the core-libs-dev mailing list