dbertoni    01/01/30 14:05:14

  Modified:    c/src/XSLT ElemElement.cpp ElemElement.hpp
  Log:
  Disabled namespace aliases in NamespacesHandler.  Improved warnings.  Added 
new member function to skip execution of xsl:attribute children.
  
  Revision  Changes    Path
  1.17      +45 -11    xml-xalan/c/src/XSLT/ElemElement.cpp
  
  Index: ElemElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElemElement.cpp   2001/01/30 00:38:00     1.16
  +++ ElemElement.cpp   2001/01/30 22:05:11     1.17
  @@ -93,6 +93,10 @@
                                                stylesheetTree.getNamespaces(),
                                                
stylesheetTree.getXSLTNamespaceURI())   
   {
  +     // Namespace aliases are not used for xsl:element, so
  +     // turn them off...
  +     m_namespacesHandler.setProcessNamespaceAliaises(false);
  +
        const unsigned int      nAttrs = atts.getLength();
   
        for(unsigned int i = 0; i < nAttrs; i++)
  @@ -194,11 +198,9 @@
   
        if (isIllegalElement == true)
        {
  -             executionContext.warn("Illegal element name!", sourceNode, 
this);
  +             executionContext.warn("Illegal element name: \"" + elemName + 
"\"", this, sourceNode);
   
                clear(elemName);
  -
  -             len = 0;
        }
        else if (haveNamespace == true)
        {
  @@ -212,15 +214,17 @@
   
                if (length(theNamespace) == 0 && 
length(m_namespacesHandler.getNamespace(prefix)) == 0)
                {
  -                     executionContext.warn("Could not resolve prefix: " + 
prefix, this);
  +                     executionContext.warn("Could not resolve prefix: " + 
prefix, this, sourceNode);
  +
  +                     isIllegalElement = true;
                }
        }
   
  -     if (len != 0)
  +     if (isIllegalElement == false)
        {
                if(0 == m_namespaceAVT)
                {
  -                     executionContext.startElement(toCharArray(elemName));   
  +                     executionContext.startElement(c_wstr(elemName));   
   
                        
m_namespacesHandler.outputResultNamespaces(executionContext);
                }
  @@ -234,13 +238,13 @@
   
                        if(isEmpty(elemNameSpace) == true)
                        {
  -                             
executionContext.startElement(toCharArray(elemName));   
  +                             
executionContext.startElement(c_wstr(elemName));   
   
                                
m_namespacesHandler.outputResultNamespaces(executionContext);
                        }
                        else
                        {
  -                             
executionContext.startElement(toCharArray(elemName));
  +                             executionContext.startElement(c_wstr(elemName));
   
                                
m_namespacesHandler.outputResultNamespaces(executionContext);
   
  @@ -254,10 +258,40 @@
   
        ElemUse::execute(executionContext, sourceTree, sourceNode, mode);
   
  -     executeChildren(executionContext, sourceTree, sourceNode, mode);
  +     doExecuteChildren(executionContext, sourceTree, sourceNode, mode, 
isIllegalElement);
   
  -     if (len != 0)
  +     if (isIllegalElement == false)
  +     {
  +             executionContext.endElement(c_wstr(elemName));
  +     }
  +}
  +
  +
  +
  +void
  +ElemElement::doExecuteChildren(
  +                     StylesheetExecutionContext&             
executionContext,
  +                     XalanNode*                                              
sourceTree,
  +                     XalanNode*                                              
sourceNode,
  +                     const QName&                                    mode,
  +                     bool                                                    
skipAttributeChildren) const
  +{
  +     if (skipAttributeChildren == false)
  +     {
  +             // If we should execute all children, then just call
  +             // executeChildren()...
  +             executeChildren(executionContext, sourceTree, sourceNode, mode);
  +     }
  +     else
        {
  -             executionContext.endElement(toCharArray(elemName));
  +             StylesheetExecutionContext::PushAndPopElementFrame      
thePushAndPop(executionContext, this);
  +
  +             for (ElemTemplateElement* node = getFirstChildElem(); node != 
0; node = node->getNextSiblingElem()) 
  +             {
  +                     if (node->getXSLToken() != 
Constants::ELEMNAME_ATTRIBUTE)
  +                     {
  +                             node->execute(executionContext, sourceTree, 
sourceNode, mode);
  +                     }
  +             }
        }
   }
  
  
  
  1.7       +20 -1     xml-xalan/c/src/XSLT/ElemElement.hpp
  
  Index: ElemElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemElement.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ElemElement.hpp   2000/11/02 01:46:23     1.6
  +++ ElemElement.hpp   2001/01/30 22:05:12     1.7
  @@ -58,7 +58,7 @@
   #define XALAN_ELEMELEMENT_HEADER_GUARD 
   
   /**
  - * $Id: ElemElement.hpp,v 1.6 2000/11/02 01:46:23 dbertoni Exp $
  + * $Id: ElemElement.hpp,v 1.7 2001/01/30 22:05:12 dbertoni Exp $
    * 
    * 
    * $State: Exp $
  @@ -123,6 +123,25 @@
                        XalanNode*                                              
sourceTree,
                        XalanNode*                                              
sourceNode,
                        const QName&                                    mode) 
const;
  +
  +protected:
  +
  +     /** 
  +      * Process the children of a template.
  +      * 
  +      * @param executionContext The current execution context
  +      * @param sourceTree input source tree
  +      * @param sourceNode current context node
  +      * @param mode current mode
  +      * @param skipAttributeChildren If true, attribute children will not be 
executed.
  +      */
  +     virtual void
  +     doExecuteChildren(
  +                     StylesheetExecutionContext&             
executionContext,
  +                     XalanNode*                                              
sourceTree,
  +                     XalanNode*                                              
sourceNode,
  +                     const QName&                                    mode,
  +                     bool                                                    
skipAttributeChildren) const;
   
   private:
   
  
  
  

Reply via email to