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

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7834

Attributes missing when writing extension-elements.

           Summary: Attributes missing when writing extension-elements.
           Product: XalanJ2
           Version: 2.3Dx
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.transformer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When writing a extension-element that returns a nodeset through the return-
method or by using outputtoresulttree, the attributes dissapears.

I think I have found the problem. It is in the class:
org.apache.xalan.transformer.ClonerToResultTree
In line 213:
      case DTM.ELEMENT_NODE :
Here the attributes gets added before the element node. I'm able to fix the 
problem by moving the adding of the attributes below the processing of the 
element-node.

The case will look something like this:
        {


          String ns = dtm.getNamespaceURI(node);
          // JJK SAX apparently expects "no namespace" to be represented
          // as "" rather than null.
          if(ns==null)ns="";

          String localName = dtm.getLocalName(node);

          rth.startElement(ns, localName, dtm.getNodeNameX(node), null);
          //Attributes atts;
          if (shouldCloneAttributes)
          {
            rth.addAttributes(node);
            rth.processNSDecls(node, nodeType, dtm);
          }
        }
        break;

Reply via email to