DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27579>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27579

xmlns:* attributes copied incorrectly in literal result element

           Summary: xmlns:* attributes copied incorrectly in literal result
                    element
           Product: XalanJ2
           Version: 2.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.templates
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When a literal result element is generated its xmlns:* attributes are not copied
according to the XSLT specification 7.1.1
(http://www.w3.org/TR/xslt#literal-result-element). The spec states that usually
an attribute should be copied, and an xmlns:* attribute is not a special case.
But with Xalan the xmlns:* attribute is copied into the result element or an
ancestor of the result element, whichever is the earliest and as long as it is
not repeated.

Here's why it's a problem. I want my XSLT to generate a document like this:

<my-element>
  <inner-element aaa:attr="value" xmlns:aaa="my namespace URI">
    This is my content
  </inner-element>
</my-element>

But if I put this into an XSLT template to output literally the xmlns:aaa
attribute mysteriously moves into its parent element. The attached code (java
version "1.4.1_05") demonstrates this.

I want the xmlns:aaa attribute to be in the <inner-element> because I want to
pick out that element and make it the top element of a new document. But now I
can't because the <inner-element>, which was valid XML in isolation, has lost
its namespace declaration and so no longer is valid in isolation.

Reply via email to