dbertoni    01/09/18 09:29:43

  Modified:    c/src/XSLT ElemLiteralResult.cpp ElemLiteralResult.hpp
                        NamespacesHandler.cpp NamespacesHandler.hpp
  Log:
  Make sure exclude-result-prefix excludes by namespace URI, not by prefix.  
Exclude the xml prefix namespace URI (http://www.w3.org/XML/1998/namespace).
  
  Revision  Changes    Path
  1.42      +5 -20     xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
  
  Index: ElemLiteralResult.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- ElemLiteralResult.cpp     2001/07/18 04:33:15     1.41
  +++ ElemLiteralResult.cpp     2001/09/18 16:29:43     1.42
  @@ -267,7 +267,6 @@
   {
        if (isEmpty(thePrefix) == true ||
            shouldExcludeResultNamespaceNode(
  -                     thePrefix,
                        theValue) == false)
        {
                executionContext.addResultAttribute(
  @@ -281,8 +280,10 @@
   void
   ElemLiteralResult::execute(StylesheetExecutionContext&       
executionContext) const
   {
  -     executionContext.startElement(c_wstr(getElementName()));
  +     const XalanDOMString&   theElementName = getElementName();
   
  +     executionContext.startElement(c_wstr(theElementName));
  +
        ElemUse::execute(executionContext);
   
        m_namespacesHandler.outputResultNamespaces(executionContext);
  @@ -340,20 +341,8 @@
        }
   
        executeChildren(executionContext);
  -
  -     executionContext.endElement(c_wstr(getElementName()));
  -}
  -
   
  -
  -bool
  -ElemLiteralResult::isAttrOK(
  -                     int                                             tok,
  -                     const XalanDOMChar*             attrName,
  -                     const AttributeList&    atts,
  -                     int                                             which) 
const
  -{
  -     return ElemUse::isAttrOK(tok, attrName, atts, which);
  +     executionContext.endElement(c_wstr(theElementName));
   }
   
   
  @@ -390,7 +379,6 @@
                }
       }
   
  -    // TODO: Well, process it...
       return isAttrOK;
   }
   
  @@ -424,12 +412,9 @@
   
   
   bool
  -ElemLiteralResult::shouldExcludeResultNamespaceNode(
  -                     const XalanDOMString&   thePrefix,
  -                     const XalanDOMString&   theURI) const
  +ElemLiteralResult::shouldExcludeResultNamespaceNode(const XalanDOMString&    
theURI) const
   {
        return m_namespacesHandler.shouldExcludeResultNamespaceNode(
                                getStylesheet().getXSLTNamespaceURI(),
  -                             thePrefix,
                                theURI);
   }
  
  
  
  1.22      +2 -13     xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
  
  Index: ElemLiteralResult.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ElemLiteralResult.hpp     2001/06/06 21:55:23     1.21
  +++ ElemLiteralResult.hpp     2001/09/18 16:29:43     1.22
  @@ -100,7 +100,7 @@
        ~ElemLiteralResult();
   
        // These methods are inherited from ElemUse ...
  -     
  +
        virtual const XalanDOMString&
        getElementName() const;
   
  @@ -111,13 +111,6 @@
   
        virtual bool
        isAttrOK(
  -                     int                                             tok,
  -                     const XalanDOMChar*             attrName,
  -                     const AttributeList&    atts,
  -                     int                                             which) 
const;
  -
  -     virtual bool
  -     isAttrOK(
                        const XalanDOMChar*                             
attrName,
                        const AttributeList&                    atts,
                        int                                                     
        which,
  @@ -159,14 +152,10 @@
        /**
         * Determine if the namespace node should be excluded.
         *
  -      * @param executionContext The current execution context
  -      * @param thePrefix The namespace prefix.
         * @param theURI The namespace URI.
         */
        bool
  -     shouldExcludeResultNamespaceNode(
  -                     const XalanDOMString&   thePrefix,
  -                     const XalanDOMString&   theURI) const;
  +     shouldExcludeResultNamespaceNode(const XalanDOMString&  theURI) const;
   
        /**
         * Add a result attribute, if necessary.
  
  
  
  1.14      +33 -9     xml-xalan/c/src/XSLT/NamespacesHandler.cpp
  
  Index: NamespacesHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- NamespacesHandler.cpp     2001/09/14 20:47:51     1.13
  +++ NamespacesHandler.cpp     2001/09/18 16:29:43     1.14
  @@ -127,7 +127,6 @@
   
                        if(shouldExcludeResultNamespaceNode(
                                        theXSLTNamespaceURI,
  -                                     thePrefix,
                                        theURI) == false)
                        {
                                if (m_namespaceDeclarations.count(thePrefix) == 
0)
  @@ -237,9 +236,11 @@
                                        theValue,
                                        
Constants::DEFAULT_WHITESPACE_SEPARATOR_STRING);
   
  +     XalanDOMString  thePrefix;
  +
       while(tokenizer.hasMoreTokens() == true)
       {
  -             XalanDOMString  thePrefix = tokenizer.nextToken();
  +              tokenizer.nextToken(thePrefix);
   
                if(equalsIgnoreCaseASCII(thePrefix, 
Constants::ATTRVAL_DEFAULT_PREFIX) == true)
                {
  @@ -358,7 +359,6 @@
   bool
   NamespacesHandler::shouldExcludeResultNamespaceNode(
                        const XalanDOMString&   theXSLTNamespaceURI,
  -                     const XalanDOMString&   thePrefix,
                        const XalanDOMString&   theURI) const
   {
        // These are commone namespaces that are always excluded...
  @@ -371,9 +371,9 @@
        {
                return true;
        }
  -     else if (m_excludedResultPrefixes.count(thePrefix) != 0)
  +     else if (isExcludedNamespaceURI(theURI) == true)
        {
  -             // It was found in the excluded result prefixes...
  +             // It was found in the excluded result prefixes URIs...
                return true;
        }
        else
  @@ -437,18 +437,42 @@
                        const NamespacesHandler&        
stylesheetNamespacesHandler,
                        const NameSpace&                        theNamespace) 
const
   {
  -     const XalanDOMString&   thePrefix = theNamespace.getPrefix();
        const XalanDOMString&   theURI = theNamespace.getURI();
   
  -     
  -     if(shouldExcludeResultNamespaceNode(theXSLTNamespaceURI, thePrefix, 
theURI) == true)
  +     if(shouldExcludeResultNamespaceNode(theXSLTNamespaceURI, theURI) == 
true)
        {
                return true;
        }
        else
  +     {
  +             return 
stylesheetNamespacesHandler.isExcludedNamespaceURI(theURI);
  +     }
  +}
  +
  +
  +
  +bool
  +NamespacesHandler::isExcludedNamespaceURI(const XalanDOMString&              
theNamespaceURI) const
  +{
  +     ExcludedResultPrefixesMapType::const_iterator           i =
  +                     m_excludedResultPrefixes.begin();
  +
  +     const ExcludedResultPrefixesMapType::const_iterator             theEnd =
  +                     m_excludedResultPrefixes.end();
  +
  +     while(i != theEnd)
        {
  -             return 
stylesheetNamespacesHandler.hasExcludedPrefix(theNamespace.getPrefix());
  +             if (equals((*i).second, theNamespaceURI) == true)
  +             {
  +                     return true;
  +             }
  +             else
  +             {
  +                     ++i;
  +             }
        }
  +
  +     return false;
   }
   
   
  
  
  
  1.11      +11 -16    xml-xalan/c/src/XSLT/NamespacesHandler.hpp
  
  Index: NamespacesHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NamespacesHandler.hpp     2001/08/13 17:08:53     1.10
  +++ NamespacesHandler.hpp     2001/09/18 16:29:43     1.11
  @@ -261,30 +261,15 @@
         * Determine of a given namespace should be excluded.
         *
         * @param theXSLTNamespaceURI The namespace URI for XSLT.
  -      * @param thePrefix The namespace prefix.
         * @param theURI The namespace URI.
         * @return true of the namespace should be excluded, false if not.
         */
        bool
        shouldExcludeResultNamespaceNode(
                        const XalanDOMString&   theXSLTNamespaceURI,
  -                     const XalanDOMString&   thePrefix,
                        const XalanDOMString&   theURI) const;
   
        /**
  -      * Determine if a given prefix is in the list of excluded
  -      * prefixes.
  -      *
  -      * @param thePrefix The namespace prefix.
  -      * @return true of the prefix should be excluded, false if not.
  -      */
  -     bool
  -     hasExcludedPrefix(const XalanDOMString&         thePrefix) const
  -     {
  -             return m_excludedResultPrefixes.count(thePrefix) != 0 ? true : 
false;
  -     }
  -
  -     /**
         * Add a URI as an extension namespace prefixes.
         *
         * @param theURI The namespace URI.
  @@ -436,7 +421,7 @@
        copyExcludeResultPrefixes(const ExcludedResultPrefixesMapType&  
theExcludeResultPrefixes);
   
        /**
  -      * Determine of a given namespace should be excluded.  For use during
  +      * Determine if a given namespace should be excluded.  For use during
         * stylesheet construction only.
         *
         * @param theXSLTNamespaceURI The namespace URI for XSLT.
  @@ -449,6 +434,16 @@
                        const XalanDOMString&           theXSLTNamespaceURI,
                        const NamespacesHandler&        parentNamespacesHandler,
                        const NameSpace&                        theNamespace) 
const;
  +
  +     /**
  +      * Determine of a given namespace should be excluded as a result of
  +      * an exclude-result-prefixes declaration.
  +      *
  +      * @param theNamespaceURI The namespace URI to check.
  +      * @return true of the namespace should be excluded, false if not.
  +      */
  +     bool
  +     isExcludedNamespaceURI(const XalanDOMString&    theNamespaceURI) const;
   
        // Not implemented...
        bool
  
  
  

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

Reply via email to