dbertoni    01/01/26 14:02:41

  Modified:    c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Cleaned up some unused stuff and separated a function into two different ones.
  
  Revision  Changes    Path
  1.82      +47 -50    xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
  
  Index: XSLTEngineImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- XSLTEngineImpl.cpp        2001/01/25 17:06:37     1.81
  +++ XSLTEngineImpl.cpp        2001/01/26 22:02:34     1.82
  @@ -1402,10 +1402,10 @@
        assert(getFormatterListener() != 0);
        assert(m_executionContext != 0);
   
  -     m_resultNamespacesStack.pushContext();
  -
        if (getHasPendingStartDocument() == false)
        {
  +             m_resultNamespacesStack.pushContext();
  +
                setHasPendingStartDocument(true);
   
                setMustFlushPendingStartDocument(false);
  @@ -1449,6 +1449,8 @@
        }
   
        m_resultNamespacesStack.popContext();
  +
  +     assert(m_resultNamespacesStack.size() == 0);
   }
   
   
  @@ -1956,6 +1958,8 @@
   
        case XalanNode::ELEMENT_NODE:
                {
  +                     startElement(c_wstr(DOMServices::getNameOfNode(node)));
  +
                        if(shouldCloneAttributes == true)
                        {
                                copyAttributesToAttList(&node,
  @@ -1967,11 +1971,8 @@
   #endif
                                                                                
getPendingAttributesImpl());
   
  -                             copyNamespaceAttributes(node,
  -                                                                             
false);
  +                             copyNamespaceAttributes(node);
                        }
  -
  -                     startElement(c_wstr(DOMServices::getNameOfNode(node)));
                }
                break;
   
  @@ -2240,64 +2241,60 @@
   
   
   void
  -XSLTEngineImpl::copyNamespaceAttributes(
  -                     const XalanNode&        src,
  -                     bool                            /* srcIsStylesheetTree 
*/) 
  +XSLTEngineImpl::addResultNamespace(
  +                     const XalanNode&        theNode,
  +                     AttributeListImpl&      thePendingAttributes)
   {
  -     int type;
  +     assert(theNode.getNodeType() == XalanNode::ATTRIBUTE_NODE);
   
  -     const XalanNode*        parent = &src;
  +     const XalanDOMString&   aname = theNode.getNodeName();
   
  -     while (parent != 0
  -                && ((type = parent->getNodeType()) == XalanNode::ELEMENT_NODE
  -                        || type == XalanNode::ENTITY_REFERENCE_NODE)) 
  +     const bool      isPrefix = startsWith(aname, 
DOMServices::s_XMLNamespaceWithSeparator);
  +
  +     if (equals(aname, DOMServices::s_XMLNamespace) || isPrefix) 
        {
  -             if (type == XalanNode::ELEMENT_NODE) 
  +             const XalanDOMString    prefix = isPrefix == true ?
  +                     substring(aname, 
DOMServices::s_XMLNamespaceWithSeparatorLength) : XalanDOMString();
  +
  +             const XalanDOMString&   desturi = 
getResultNamespaceForPrefix(prefix);
  +             const XalanDOMString&   srcURI = theNode.getNodeValue();
  +
  +             if(equals(srcURI, desturi) == false)
                {
  -                     const XalanNamedNodeMap* const  nnm =
  -                             parent->getAttributes();
  -                     assert(nnm != 0);
  +                     addResultAttribute(thePendingAttributes, aname, srcURI);
  +             }
  +     }
  +}
   
  -                     const unsigned int      nAttrs = nnm->getLength();
   
  -                     assert(m_outputContextStack.size() > 0);
   
  -                     AttributeListImpl&      thePendingAttributes =
  -                             getPendingAttributesImpl();
  +void
  +XSLTEngineImpl::copyNamespaceAttributes(const XalanNode&     src) 
  +{
  +     int type;
   
  -                     for (unsigned int i = 0;  i < nAttrs; i++) 
  -                     {
  -                             const XalanNode* const  attr = nnm->item(i);
  +     const XalanNode*        parent = &src;
   
  -                             const XalanDOMString&   aname = 
attr->getNodeName();
  +     while (parent != 0 &&
  +                (type = parent->getNodeType()) == XalanNode::ELEMENT_NODE) 
  +     {
  +             const XalanNamedNodeMap* const  nnm =
  +                             parent->getAttributes();
  +             assert(nnm != 0);
   
  -                             const bool                              
isPrefix = startsWith(aname, DOMServices::s_XMLNamespaceWithSeparator);
  +             const unsigned int      nAttrs = nnm->getLength();
   
  -                             if (equals(aname, DOMServices::s_XMLNamespace) 
|| isPrefix) 
  -                             {
  -                                     const XalanDOMString    prefix = 
isPrefix ? substring(aname, 6) : XalanDOMString();
  -                                     const XalanDOMString&   desturi = 
getResultNamespaceForPrefix(prefix);
  -                                     const XalanDOMString&   srcURI = 
attr->getNodeValue();
  -                                     /*
  -                                     @@ JMD: Not used anymore in java ...
  -                                     const bool                      isXSLNS 
=
  -                                             srcIsStylesheetTree && 
equalsIgnoreCase(srcURI, s_XSLNameSpaceURL)
  -                                             || 0 != 
m_stylesheetRoot->lookupExtensionNSHandler(srcURI)
  -                                             || srcIsStylesheetTree && 
equalsIgnoreCase(srcURI, s_XSLT4JNameSpaceURL);
  +             assert(m_outputContextStack.size() > 0);
   
  -                                     if(startsWith(srcURI, 
XALAN_STATIC_UCODE_STRING("quote:")))
  -                                     {
  -                                             srcURI = substring(srcURI, 6);
  -                                     }
  +             AttributeListImpl&      thePendingAttributes =
  +                             getPendingAttributesImpl();
   
  -                                     if(!equalsIgnoreCase(srcURI, desturi) 
&& !isXSLNS)
  -                                     */
  -                                     if(!equalsIgnoreCase(srcURI, desturi))
  -                                     {
  -                                             
addResultAttribute(thePendingAttributes, aname, srcURI);
  -                                     }
  -                             }
  -                     }
  +             for (unsigned int i = 0;  i < nAttrs; i++) 
  +             {
  +                     const XalanNode* const  attr = nnm->item(i);
  +                     assert(attr != 0);
  +
  +                     addResultNamespace(*attr, thePendingAttributes);
                }
   
                parent = parent->getParentNode();
  
  
  
  1.59      +6 -10     xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
  
  Index: XSLTEngineImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- XSLTEngineImpl.hpp        2001/01/16 02:50:03     1.58
  +++ XSLTEngineImpl.hpp        2001/01/26 22:02:36     1.59
  @@ -899,12 +899,9 @@
         * Copy XMLNS: attributes in if not already in scope.
         *
         * @param src                             source node
  -      * @param srcIsStylesheetTree true if source node is a stylesheet tree
         */
        void
  -     copyNamespaceAttributes(
  -                     const XalanNode&        src,
  -                     bool                            srcIsStylesheetTree);
  +     copyNamespaceAttributes(const XalanNode&        src);
   
        /**
         * Evaluate an xpath string and return the result.
  @@ -1473,6 +1470,11 @@
        bool
        pendingAttributesHasDefaultNS() const; 
   
  +     void
  +     addResultNamespace(
  +                     const XalanNode&        theNode,
  +                     AttributeListImpl&      thePendingAttributes);
  +
     /**
      * The top of this stack should contain the currently processed
      * stylesheet SAX locator object.
  @@ -1572,12 +1574,6 @@
         */
        mutable unsigned long   m_uniqueNSValue;        // 0
     
  -     /**
  -      * Translate CSS attributes and put them in a style tag.
  -      * @deprecated
  -      */
  -     void
  -     translateCSSAttrsToStyleAttr(AttributeListImpl&         attList);
   
        /**
         * Get an XLocator provider keyed by node.      This gets the 
association
  
  
  

Reply via email to