xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bertoni <dbert...@apache.org>
Subject Re: Assertion within Xalan on VS2005
Date Fri, 06 Jun 2008 21:59:49 GMT
zdvickery@micron.com wrote:
> Hello,
> 
...
> ---BEGIN-Program-Output---------------------------------------------
> C:\Temp\Xalan\trunk\Build\Win32\VC8\Debug>TransformToXercesDOM birds.xml
> birds.xsl 
> Assertion failed: theFormatter != 0 && theFormatter->getWriter() != 0,
> file ..\..\..\..\src\xalanc\XSLT\XSLTEngineImpl.cpp, line 1568
> ---END-Program-Output-----------------------------------------------
> 
> ---BEGIN-STACK-TRACE------------------------------------------------
>  	msvcr80d.dll!__NMSG_WRITE()  + 0x73 bytes	
>  	msvcr80d.dll!_abort()  + 0x2b bytes	
>  	msvcr80d.dll!__wassert()  + 0x2ef bytes	
>> 	Xalan-C_1_10D.dll!xalanc_1_10::XSLTEngineImpl::flushPending()
> Line 1568 + 0x37 bytes	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::XSLTEngineImpl::startElement(const
> wchar_t * name=0x00994b00)  Line 1646	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::StylesheetExecutionContextDefault::startE
> lement(const wchar_t * name=0x00994b00)  Line 981	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::ElemLiteralResult::startElement(xalanc_1_
> 10::StylesheetExecutionContext & executionContext={...})  Line 326 +
> 0x1f bytes	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::ElemTemplateElement::execute(xalanc_1_10:
> :StylesheetExecutionContext & executionContext={...})  Line 253 + 0x13
> bytes	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::StylesheetRoot::process(xalanc_1_10::Xala
> nNode * sourceTree=0x0095fd00, xalanc_1_10::XSLTResultTarget &
> outputTarget={...}, xalanc_1_10::StylesheetExecutionContext &
> executionContext={...})  Line 263 + 0x13 bytes	C++
>  	Xalan-C_1_10D.dll!xalanc_1_10::XSLTEngineImpl::process(const
> xalanc_1_10::XSLTInputSource & inputSource={...}, const
> xalanc_1_10::XSLTInputSource & stylesheetSource={...},
> xalanc_1_10::XSLTResultTarget & outputTarget={...},
> xalanc_1_10::StylesheetConstructionContext & constructionContext={...},
> xalanc_1_10::StylesheetExecutionContext & executionContext={...})  Line
> 354	C++
>  
> Xalan-C_1_10D.dll!xalanc_1_10::XalanTransformer::doTransform(const
> xalanc_1_10::XalanParsedSource & theParsedXML={...}, const
> xalanc_1_10::XalanCompiledStylesheet * theCompiledStylesheet=0x00000000,
> const xalanc_1_10::XSLTInputSource * theStylesheetSource=0x0012fbac,
> const xalanc_1_10::XSLTResultTarget & theResultTarget={...})  Line 1305
> C++
>  	Xalan-C_1_10D.dll!xalanc_1_10::XalanTransformer::transform(const
> xalanc_1_10::XalanParsedSource & theParsedXML={...}, const
> xalanc_1_10::XSLTInputSource & theStylesheetSource={...}, const
> xalanc_1_10::XSLTResultTarget & theResultTarget={...})  Line 178
> C++
>  
> TransformToXercesDOM.exe!transformAndSerialize(xalanc_1_10::XalanTransfo
> rmer & theTransformer={...}, const xalanc_1_10::XalanParsedSource &
> theParsedSource={...}, const xalanc_1_10::XalanParsedSource &
> theStylesheet={...})  Line 155 + 0x7b bytes	C++
>  	TransformToXercesDOM.exe!main(int argc=3, char * *
> argv=0x003840b8)  Line 238 + 0x1a bytes	C++
>  	TransformToXercesDOM.exe!__tmainCRTStartup()  Line 597 + 0x19
> bytes	C
>  	TransformToXercesDOM.exe!mainCRTStartup()  Line 414	C
>  	kernel32.dll!_BaseProcessStart@4()  + 0x23 bytes	
> ---END-STACK-TRACE--------------------------------------------------
> 
> Producing the assertion failure seems to require not having an
> xsl:output tag in the stylesheet while also using a root-level template
> match.  I looked in the debugger and the assertion is failing because
> the statement "theFormatter->getWriter()" is returning 0. 
> 
> I tried this example (birds.xml & modified birds.xsl) with another XSLT
> engine and it worked as expected.  So I'm curious if this behavior is a
> bug in Xalan or if perhaps there is alternate explanation.
I'm not sure the comparison is relevant, because the other processor 
wasn't trying to build a DOM as the result tree.

What's happening is the processor is trying to switch to HTML output as 
required by the XSLT recommendation:

http://www.w3.org/TR/xslt#output

"The default for the method attribute is chosen as follows. If

     * the root node of the result tree has an element child,

     * the expanded-name of the first element child of the root node 
(i.e. the document element) of the result tree has local part html (in 
any combination of upper and lower case) and a null namespace URI, and

     * any text nodes preceding the first element child of the root node 
of the result tree contain only whitespace characters,

then the default output method is html; otherwise, the default output 
method is xml. The default output method should be used if there are no 
xsl:output elements or if none of the xsl:output elements specifies a 
value for the method attribute."

So, for your stylesheet, the output method is HTML, and the processor is 
trying to do that, but it just won't work when the output formatter is 
producing a DOM.

I'm going to change the code so it doesn't assert and crash, which it 
really shouldn't do.  However, it won't be possible to switch to HTML 
output, and your stylesheet will need to make sure it generates a 
well-formed DOM.  Otherwise, you'll get an exception and an error 
message at some point.

Can you please create a Jira issue here, and attach the sample stylesheet?

https://issues.apache.org/jira/browse/XALANC

Thanks,

Dave

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


Mime
View raw message