You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Adrien de Sentenac <a....@gmail.com> on 2006/01/26 15:23:49 UTC

Problem with empty text nodes in transformation

Hello,
I want to transform a Xerces DOM tree using Xalan.
It generally works fine, except when i have nodes with empty strings in the
tree.
These nodes are created with createTextNode(0), and i need that for my
application.
When my tree has such 'empty' node, it fails in
XSLTEngineImpl::cloneToResultTree on the assert that 0 != length(data)

That looks like this bug :
https://issues.apache.org/jira/browse/XALANJ-1888for XalanJ but i
found nothing for this problem on XalanC.
Is it a wanted behaviour ? Is there a workaround ? and if not should i fill
a bug report for XalanC ?

I attach a small source file to reproduce this behaviour with a xsl file.
I've tested with Xerces-C++ 2.7.0 and Xalan-C++ 1.9.0 and 1.10.0.

Thanks for your answers,
Adrien de Sentenac

Re: Problem with empty text nodes in transformation

Posted by David Bertoni <db...@apache.org>.
Adrien de Sentenac wrote:
> Hello,
> I want to transform a Xerces DOM tree using Xalan.
> It generally works fine, except when i have nodes with empty strings in 
> the tree.
> These nodes are created with createTextNode(0), and i need that for my 
> application.
> When my tree has such 'empty' node, it fails in 
> XSLTEngineImpl::cloneToResultTree on the assert that 0 != length(data)
> 

That's because the XPath data model does not allow for empty text nodes.

> That looks like this bug : 
> https://issues.apache.org/jira/browse/XALANJ-1888 
> <https://issues.apache.org/jira/browse/XALANJ-1888> for XalanJ but i 
> found nothing for this problem on XalanC.

That's a completely different bug, because that one is related to 
building the source tree, not transforming it.

> Is it a wanted behaviour ? Is there a workaround ? and if not should i 
> fill a bug report for XalanC ?

As I noted previously, this is not really a bug.  Since the data model 
does not allow for empty text nodes, the code is asserting that what it 
gets complies with the data model.

If you really need to transform something that doesn't comply with the 
data model, then you might consider just removing the assert from the 
source code and rebuilding.  I'm not sure if there are any other places 
where you'll have problems, but you can certainly give it a try.

Dave