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 2003/12/29 02:25:52 UTC

cvs commit: xml-xalan/c/src/xalanc/XSLT ElemExtensionCall.cpp ElemFallback.cpp StylesheetConstructionContext.hpp StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetHandler.cpp

dbertoni    2003/12/28 17:25:52

  Modified:    c/Projects/Win32/VC6/AllInOne AllInOne.dsp
                        AllInOneWithICU.dsp
               c/src/xalanc/XSLT ElemExtensionCall.cpp ElemFallback.cpp
                        StylesheetConstructionContext.hpp
                        StylesheetConstructionContextDefault.cpp
                        StylesheetConstructionContextDefault.hpp
                        StylesheetHandler.cpp
  Log:
  Fix for forward-compatible processing.  See conformance test ver08.
  
  Revision  Changes    Path
  1.44      +8 -0      xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp
  
  Index: AllInOne.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOne.dsp,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- AllInOne.dsp	29 Dec 2003 00:26:53 -0000	1.43
  +++ AllInOne.dsp	29 Dec 2003 01:25:52 -0000	1.44
  @@ -3350,5 +3350,13 @@
   SOURCE=..\..\Res\AllInOne\resource.h
   # End Source File
   # End Group
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xalanc\XSLT\ElemForwardCompatible.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xalanc\XSLT\ElemForwardCompatible.hpp
  +# End Source File
   # End Target
   # End Project
  
  
  
  1.41      +8 -0      xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp
  
  Index: AllInOneWithICU.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/Projects/Win32/VC6/AllInOne/AllInOneWithICU.dsp,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- AllInOneWithICU.dsp	29 Dec 2003 00:26:53 -0000	1.40
  +++ AllInOneWithICU.dsp	29 Dec 2003 01:25:52 -0000	1.41
  @@ -3422,5 +3422,13 @@
   SOURCE=..\..\..\..\src\xalanc\XercesParserLiaison\XercesWrapperTypes.hpp
   # End Source File
   # End Group
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xalanc\XSLT\ElemForwardCompatible.cpp
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=..\..\..\..\src\xalanc\XSLT\ElemForwardCompatible.hpp
  +# End Source File
   # End Target
   # End Project
  
  
  
  1.4       +3 -1      xml-xalan/c/src/xalanc/XSLT/ElemExtensionCall.cpp
  
  Index: ElemExtensionCall.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemExtensionCall.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElemExtensionCall.cpp	2 Dec 2003 19:58:54 -0000	1.3
  +++ ElemExtensionCall.cpp	29 Dec 2003 01:25:52 -0000	1.4
  @@ -97,8 +97,10 @@
   
   
   void
  -ElemExtensionCall::execute(StylesheetExecutionContext&		executionContext) const
  +ElemExtensionCall::execute(StylesheetExecutionContext&	executionContext) const
   {
  +	ElemTemplateElement::execute(executionContext);
  +
   	executionContext.warn( 
   		XalanMessageLoader::getMessage(XalanMessages::XalanHandleExtensions),
   		0,
  
  
  
  1.5       +22 -1     xml-xalan/c/src/xalanc/XSLT/ElemFallback.cpp
  
  Index: ElemFallback.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/ElemFallback.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElemFallback.cpp	4 Dec 2003 21:47:45 -0000	1.4
  +++ ElemFallback.cpp	29 Dec 2003 01:25:52 -0000	1.5
  @@ -133,7 +133,28 @@
   {
   	ElemTemplateElement::execute(executionContext);
   
  -	executeChildren(executionContext);
  +	int		thePreviousToken = StylesheetConstructionContext::ELEMNAME_UNDEFINED;
  +
  +	for (const ElemTemplateElement*	child = getFirstChildElem(); child != 0; child = child->getNextSiblingElem())
  +	{
  +		const int	theCurrentToken = child->getXSLToken();
  +
  +		if(theCurrentToken == StylesheetConstructionContext::ELEMNAME_FALLBACK)
  +		{
  +			// Don't execute a fallback if it's preceeded by a forward-compatible
  +			// element.
  +			if (thePreviousToken != StylesheetConstructionContext::ELEMNAME_FORWARD_COMPATIBLE)
  +			{
  +				child->execute(executionContext);
  +			}
  +		}
  +		else
  +		{
  +			child->execute(executionContext);
  +		}
  +
  +		thePreviousToken = theCurrentToken;
  +	}
   }
   
   
  
  
  
  1.3       +10 -3     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp
  
  Index: StylesheetConstructionContext.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContext.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StylesheetConstructionContext.hpp	19 Sep 2003 20:33:04 -0000	1.2
  +++ StylesheetConstructionContext.hpp	29 Dec 2003 01:25:52 -0000	1.3
  @@ -181,6 +181,11 @@
   		// element.
   		ELEMNAME_TEXT_LITERAL_RESULT,
   
  +		// This one doesn't really have a name.
  +		// It's used for forward-compatible
  +		// processing.
  +		ELEMNAME_FORWARD_COMPATIBLE,
  +
   		// Extension handling.
   		ELEMNAME_EXTENSION_CALL,
   		ELEMNAME_EXTENSION_HANDLER
  @@ -665,10 +670,11 @@
   			const LocatorType*			locator = 0) = 0;
   
   	/**
  -	 * Create a literal result element. The instance owns the
  -	 * memory and will delete the element when it goes out of
  -	 * scope and the containing stylesheet is destroyed.
  +	 * Create a elements which have specific names. The instance
  +	 * owns the memory and will delete the element when it goes
  +	 * out of scope and the containing stylesheet is destroyed.
   	 *
  +	 * @param token The enum value of the element to create.
   	 * @param stylesheetTree The stylesheet containing the element
   	 * @param name The name of the element
   	 * @param atts The list of attributes for the element
  @@ -678,6 +684,7 @@
   	 */
   	virtual ElemTemplateElement*
   	createElement(
  +			int							token,
   			Stylesheet&					stylesheetTree,
   			const XalanDOMChar*			name,
   			const AttributeListType&	atts,
  
  
  
  1.6       +28 -1     xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp
  
  Index: StylesheetConstructionContextDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StylesheetConstructionContextDefault.cpp	2 Dec 2003 19:58:54 -0000	1.5
  +++ StylesheetConstructionContextDefault.cpp	29 Dec 2003 01:25:52 -0000	1.6
  @@ -93,6 +93,7 @@
   #include "ElemDecimalFormat.hpp"
   #include "ElemExtensionCall.hpp"
   #include "ElemFallback.hpp"
  +#include "ElemForwardCompatible.hpp"
   #include "ElemForEach.hpp"
   #include "ElemIf.hpp"
   #include "ElemMessage.hpp"
  @@ -971,6 +972,7 @@
   
   ElemTemplateElement*
   StylesheetConstructionContextDefault::createElement(
  +			int							token,
   			Stylesheet&					stylesheetTree,
   			const XalanDOMChar*			name,
   			const AttributeListType&	atts,
  @@ -979,13 +981,38 @@
   	const XalanLocator::size_type	lineNumber = XalanLocator::getLineNumber(locator);
   	const XalanLocator::size_type	columnNumber = XalanLocator::getColumnNumber(locator);
   
  -	return m_elemLiteralResultAllocator.create(
  +	ElemTemplateElement*	theElement = 0;
  +
  +	if (token == ELEMNAME_LITERAL_RESULT)
  +	{
  +		theElement = m_elemLiteralResultAllocator.create(
  +			*this,
  +			stylesheetTree,
  +			name,
  +			atts,
  +			lineNumber,
  +			columnNumber);
  +	}
  +	else if (token == ELEMNAME_FORWARD_COMPATIBLE)
  +	{
  +		m_allocatedElements.push_back(0);
  +
  +		theElement = new ElemForwardCompatible(
   			*this,
   			stylesheetTree,
   			name,
   			atts,
   			lineNumber,
   			columnNumber);
  +
  +		m_allocatedElements.back() = theElement;
  +	}
  +	else
  +	{
  +		error(XalanMessageLoader::getMessage(XalanMessages::UnknownXSLTToken_1Param, LongToDOMString(token)), 0, locator);
  +	}
  +
  +	return theElement;
   }
   
   
  
  
  
  1.3       +1 -0      xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp
  
  Index: StylesheetConstructionContextDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetConstructionContextDefault.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StylesheetConstructionContextDefault.hpp	19 Sep 2003 20:33:04 -0000	1.2
  +++ StylesheetConstructionContextDefault.hpp	29 Dec 2003 01:25:52 -0000	1.3
  @@ -456,6 +456,7 @@
   
   	virtual ElemTemplateElement*
   	createElement(
  +			int							token,
   			Stylesheet&					stylesheetTree,
   			const XalanDOMChar*			name,
   			const AttributeListType&	atts,
  
  
  
  1.7       +18 -1     xml-xalan/c/src/xalanc/XSLT/StylesheetHandler.cpp
  
  Index: StylesheetHandler.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/XSLT/StylesheetHandler.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StylesheetHandler.cpp	2 Dec 2003 19:58:54 -0000	1.6
  +++ StylesheetHandler.cpp	29 Dec 2003 01:25:52 -0000	1.7
  @@ -523,6 +523,13 @@
   						if(m_constructionContext.getXSLTVersionSupported() < m_stylesheet.getXSLTVerDeclared())
   						{
   							warn(name, XalanMessageLoader::getMessage(XalanMessages::UnknownXSLElement), locator);
  +
  +							elem = m_constructionContext.createElement(
  +										StylesheetConstructionContext::ELEMNAME_FORWARD_COMPATIBLE,
  +										m_stylesheet,
  +										name,
  +										atts,
  +										locator);
   						}
   						else
   						{
  @@ -580,6 +587,7 @@
   				else 
   				{
   					elem = m_constructionContext.createElement(
  +												StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT,
   												m_stylesheet,
   												name,
   												atts,
  @@ -643,6 +651,7 @@
   
   	ElemTemplateElement* const	pElem =
   		m_constructionContext.createElement(
  +			StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT,
   			m_stylesheet,
   			name,
   			atts,
  @@ -828,7 +837,15 @@
   	default:
   		if (inExtensionElement() == false)
   		{
  -			error(name, XalanMessageLoader::getMessage(XalanMessages::UnknownXSLElement), locator);
  +			if (m_constructionContext.getXSLTVersionSupported() < m_stylesheet.getXSLTVerDeclared())
  +			{
  +				// Forward-compatible mode...
  +				m_inExtensionElementStack.back() = true;
  +			}
  +			else
  +			{
  +				error(name, XalanMessageLoader::getMessage(XalanMessages::UnknownXSLElement), locator);
  +			}
   		}
   		break;
   	}
  
  
  

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