dbertoni    02/04/29 21:43:23

  Modified:    c/src/XSLT XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Make sure the default namespace is fixed-up when copying RTFs.
  
  Revision  Changes    Path
  1.140     +38 -8     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.139
  retrieving revision 1.140
  diff -u -r1.139 -r1.140
  --- XSLTEngineImpl.cpp        11 Apr 2002 05:54:50 -0000      1.139
  +++ XSLTEngineImpl.cpp        30 Apr 2002 04:43:23 -0000      1.140
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -2272,6 +2272,29 @@
   
   
   void
  +XSLTEngineImpl::checkDefaultNamespace(
  +                     const XalanDOMString&   theElementName,
  +                     const XalanDOMString&   theElementNamespaceURI)
  +{
  +     // Check for elements with no prefix...
  +     if (indexOf(theElementName, XalanUnicode::charColon) == 
theElementName.length())
  +     {
  +             // Get the current default namespace URI..
  +             const XalanDOMString* const             theResultNamespace =
  +                     getResultNamespaceForPrefix(s_emptyString);
  +
  +             // If there is one, and the URIs are different, add a new declaration. 
 This
  +             // will also "turn-off" the default namespace, if necessary.
  +             if (theResultNamespace != 0 && theElementNamespaceURI != 
*theResultNamespace)
  +             {
  +                     addResultAttribute(DOMServices::s_XMLNamespace, 
theElementNamespaceURI);
  +             }
  +     }
  +}
  +
  +
  +
  +void
   XSLTEngineImpl::cloneToResultTree(
                        XalanNode&                                      node,
                        XalanNode::NodeType                     nodeType,
  @@ -2329,15 +2352,22 @@
                break;
   
        case XalanNode::ELEMENT_NODE:
  -             startElement(c_wstr(node.getNodeName()));
  -
  -             if(shouldCloneAttributes == true)
                {
  -                     copyAttributesToAttList(
  -                                                                     node,
  -                                                                     
getPendingAttributesImpl());
  +                     const XalanDOMString&   theElementName =
  +                             node.getNodeName();
  +
  +                     startElement(c_wstr(theElementName));
  +
  +                     if(shouldCloneAttributes == true)
  +                     {
  +                             copyAttributesToAttList(
  +                                     node,
  +                                     getPendingAttributesImpl());
  +
  +                             copyNamespaceAttributes(node);
  +                     }
   
  -                     copyNamespaceAttributes(node);
  +                     checkDefaultNamespace(theElementName, node.getNamespaceURI());
                }
                break;
   
  
  
  
  1.85      +5 -1      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.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- XSLTEngineImpl.hpp        12 Apr 2002 04:44:36 -0000      1.84
  +++ XSLTEngineImpl.hpp        30 Apr 2002 04:43:23 -0000      1.85
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -1619,6 +1619,10 @@
                        XalanDOMString::size_type       length,
                        bool                                            isCDATA);
   
  +     void
  +     checkDefaultNamespace(
  +                     const XalanDOMString&   theElementName,
  +                     const XalanDOMString&   theElementNamespaceURI);
   
        XMLParserLiaison&       m_parserLiaison;
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to