You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/11/19 21:15:52 UTC

cvs commit: xml-xalan/c/src/XSLT ElemCopy.cpp ElemCopyOf.cpp ElemTemplateElement.cpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp

dbertoni    01/11/19 12:15:52

  Modified:    c/src/XSLT ElemCopy.cpp ElemCopyOf.cpp
                        ElemTemplateElement.cpp
                        StylesheetExecutionContext.hpp
                        StylesheetExecutionContextDefault.cpp
                        StylesheetExecutionContextDefault.hpp
                        XSLTEngineImpl.cpp XSLTEngineImpl.hpp
  Log:
  Don't generate an attribute in the result tree if no element is currently open.
  
  Revision  Changes    Path
  1.17      +2 -1      xml-xalan/c/src/XSLT/ElemCopy.cpp
  
  Index: ElemCopy.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopy.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElemCopy.cpp	2001/09/19 21:20:46	1.16
  +++ ElemCopy.cpp	2001/11/19 20:15:52	1.17
  @@ -131,7 +131,8 @@
   			nodeType,
   			false,
   			false,
  -			false);
  +			false,
  +			this);
   
   		if(XalanNode::ELEMENT_NODE == nodeType)
   		{
  
  
  
  1.24      +2 -1      xml-xalan/c/src/XSLT/ElemCopyOf.cpp
  
  Index: ElemCopyOf.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemCopyOf.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ElemCopyOf.cpp	2001/09/26 21:30:23	1.23
  +++ ElemCopyOf.cpp	2001/11/19 20:15:52	1.24
  @@ -158,7 +158,8 @@
   						posNodeType,
   						false,
   						false,
  -						true);
  +						true,
  +						this);
   
   		XalanNode*	nextNode = pos->getFirstChild();
   
  
  
  
  1.68      +1 -1      xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
  
  Index: ElemTemplateElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- ElemTemplateElement.cpp	2001/09/26 21:30:23	1.67
  +++ ElemTemplateElement.cpp	2001/11/19 20:15:52	1.68
  @@ -887,7 +887,7 @@
   			{
   			case XalanNode::CDATA_SECTION_NODE:
   			case XalanNode::TEXT_NODE:
  -				executionContext.cloneToResultTree(*child, nodeType, false, false, false);
  +				executionContext.cloneToResultTree(*child, nodeType, false, false, false, this);
   				break;
   
   			case XalanNode::ATTRIBUTE_NODE:
  
  
  
  1.69      +7 -5      xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
  
  Index: StylesheetExecutionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- StylesheetExecutionContext.hpp	2001/11/01 15:59:57	1.68
  +++ StylesheetExecutionContext.hpp	2001/11/19 20:15:52	1.69
  @@ -960,14 +960,16 @@
   	 * @param isLiteral             true if a literal element
   	 * @param overrideStrip         false if white space stripping should be done
   	 * @param shouldCloneAttributes true if attributes should be cloned
  +	 * @param styleNode				the stylesheet element that generated the clone.
   	 */
   	virtual void
   	cloneToResultTree(
  -			XalanNode&				node,
  -			XalanNode::NodeType		nodeType,
  -			bool					isLiteral,
  -			bool					overrideStrip,
  -			bool					shouldCloneAttributes) = 0;
  +			XalanNode&					node,
  +			XalanNode::NodeType			nodeType,
  +			bool						isLiteral,
  +			bool						overrideStrip,
  +			bool						shouldCloneAttributes,
  +			const ElemTemplateElement*	styleNode = 0) = 0;
   
   	/**
   	 * Create an XObject that represents a Result tree fragment.
  
  
  
  1.80      +8 -6      xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
  
  Index: StylesheetExecutionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- StylesheetExecutionContextDefault.cpp	2001/11/01 15:59:57	1.79
  +++ StylesheetExecutionContextDefault.cpp	2001/11/19 20:15:52	1.80
  @@ -906,11 +906,12 @@
   
   void
   StylesheetExecutionContextDefault::cloneToResultTree(
  -			XalanNode&				node,
  -			XalanNode::NodeType		nodeType,
  -			bool					isLiteral,
  -			bool					overrideStrip,
  -			bool					shouldCloneAttributes)
  +			XalanNode&					node,
  +			XalanNode::NodeType			nodeType,
  +			bool						isLiteral,
  +			bool						overrideStrip,
  +			bool						shouldCloneAttributes,
  +			const ElemTemplateElement*	styleNode)
   {
   	assert(m_xsltProcessor != 0);
   
  @@ -919,7 +920,8 @@
   			nodeType,
   			isLiteral,
   			overrideStrip,
  -			shouldCloneAttributes);
  +			shouldCloneAttributes,
  +			styleNode);
   }
   
   
  
  
  
  1.72      +6 -5      xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
  
  Index: StylesheetExecutionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- StylesheetExecutionContextDefault.hpp	2001/11/01 15:59:57	1.71
  +++ StylesheetExecutionContextDefault.hpp	2001/11/19 20:15:52	1.72
  @@ -484,11 +484,12 @@
   
   	virtual void
   	cloneToResultTree(
  -			XalanNode&				node,
  -			XalanNode::NodeType		nodeType,
  -			bool					isLiteral,
  -			bool					overrideStrip,
  -			bool					shouldCloneAttributes);
  +			XalanNode&					node,
  +			XalanNode::NodeType			nodeType,
  +			bool						isLiteral,
  +			bool						overrideStrip,
  +			bool						shouldCloneAttributes,
  +			const ElemTemplateElement*	styleNode = 0);
   
   	virtual const XObjectPtr
   	createXResultTreeFrag(
  
  
  
  1.126     +39 -11    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.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- XSLTEngineImpl.cpp	2001/11/01 15:59:57	1.125
  +++ XSLTEngineImpl.cpp	2001/11/19 20:15:52	1.126
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -2264,11 +2264,12 @@
   
   void
   XSLTEngineImpl::cloneToResultTree(
  -			XalanNode&				node,
  -			XalanNode::NodeType		nodeType,
  -			bool					isLiteral,
  -			bool					overrideStrip,
  -			bool					shouldCloneAttributes)
  +			XalanNode&					node,
  +			XalanNode::NodeType			nodeType,
  +			bool						isLiteral,
  +			bool						overrideStrip,
  +			bool						shouldCloneAttributes,
  +			const ElemTemplateElement*	styleNode)
   {
   	assert(nodeType == node.getNodeType());
   	assert(m_executionContext != 0);
  @@ -2340,14 +2341,41 @@
   		break;
   
   	case XalanNode::ATTRIBUTE_NODE:
  -		addResultAttribute(
  -				getPendingAttributesImpl(),
  +		if (length(getPendingElementName()) != 0)
  +		{
  +			addResultAttribute(
  +					getPendingAttributesImpl(),
   #if defined(XALAN_OLD_STYLE_CASTS)
  -				DOMServices::getNameOfNode((const XalanAttr&)node),
  +					DOMServices::getNameOfNode((const XalanAttr&)node),
   #else
  -				DOMServices::getNameOfNode(static_cast<const XalanAttr&>(node)),
  +					DOMServices::getNameOfNode(static_cast<const XalanAttr&>(node)),
   #endif
  -				node.getNodeValue());
  +					node.getNodeValue());
  +		}
  +		else
  +		{
  +			const Locator*		theLocator = 0;
  +			const char* const	theErrorMessage =
  +				"Attempting to add an attribute when there is no open element.  The attribute will be ignored";
  +
  +			if (styleNode != 0)
  +			{
  +				theLocator = styleNode->getLocator();
  +			}
  +
  +			if (theLocator != 0)
  +			{
  +				warn(XalanDOMString(theErrorMessage),
  +					*theLocator,
  +					&node);
  +			}
  +			else
  +			{
  +				warn(theErrorMessage,
  +					&node,
  +					styleNode);
  +			}
  +		}
   		break;
   
   	case XalanNode::COMMENT_NODE:
  
  
  
  1.78      +8 -6      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.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- XSLTEngineImpl.hpp	2001/10/19 18:42:23	1.77
  +++ XSLTEngineImpl.hpp	2001/11/19 20:15:52	1.78
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -589,14 +589,16 @@
   	 * @param isLiteral 			true if a literal element
   	 * @param overrideStrip 		false if white space stripping should be done
   	 * @param shouldCloneAttributes true if attributes should be cloned
  +	 * @param styleNode				the stylesheet element that generated the clone.
   	 */
   	void
   	cloneToResultTree(
  -			XalanNode& 				node,
  -			XalanNode::NodeType		nodeType,
  -			bool					isLiteral,
  -			bool					overrideStrip,
  -			bool					shouldCloneAttributes);
  +			XalanNode& 					node,
  +			XalanNode::NodeType			nodeType,
  +			bool						isLiteral,
  +			bool						overrideStrip,
  +			bool						shouldCloneAttributes,
  +			const ElemTemplateElement*	styleNode = 0);
   
   	/**
   	 * Given a result tree fragment, walk the tree and output it to the result
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org