You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Anders Blaagaard <ab...@swwwing.com> on 2004/06/09 17:27:38 UTC

Problem with empty text nodes in XSLTC transformation of DOM

I have problem with XSLTC transformation of a DOM representation that is 
similar to this (but larger):

<A>
  <B>
    <C></C>
    <D>ddddddddd</D>
    <E>eeeeeeeeeee</E>
    <F>ffffffffffff</F>
     ...
  </B>
   ...
</A>

Note that C is not an empty element, but contains a text node with the 
empty string as its value.

When I use a serializer to output the document it looks as expected, but 
when I put it through a transformation, e.g. a simple "identity" 
transformation like this:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
  <xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>

The document appears to look like this:

<A>
  <B>
    <C>dddddddddeeeeeeeeeeeffffffffffff</C>
    <D>ddddddddd</D>
    <E>eeeeeeeeeee</E>
    <F>ffffffffffff</F>
  </B>
</A>

Here are some observations I made:

- Only a XSLTC problem - works a expected with Xalan
- Seems to be independent of the stylesheet
- If the value of the text node in C is not empty, I don't get the 
problem, but it doesn't happen with any document containing an empty 
text node.

I haven't yet been able to reproduce this in a simple isolated example, 
that I can share with you, but if anyone have a clue what might be going 
on, or where to look, or how to debug, or ..., please let me know.

Thanks,
Anders Blaagaard


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


Re: Problem with empty text nodes in XSLTC transformation of DOM

Posted by Anders Blaagaard <ab...@swwwing.com>.
I don't what it to distinguish between <C/> and <C></C>.
What I was trying to explain was, that if have code like this:

Element c = document.createElement("C");
Text empty = document.createTextNode("");
c.appendChild(empty);

This can in some cases (I'm trying to isolate a reproducible one), 
produce some unexpected results when transformed with XSLTC (but NOT 
with Xalan), as explained in my first email. (If I leave the text node 
out, it works as expected).

Anders


Joseph Kesselman wrote:

>
>
>The XPath data model does not distinguish <C/> from <C></C>, I'm afraid.
>There is no such thing as an empty text node when running Xalan.
>
>______________________________________
>Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
>"The world changed profoundly and unpredictably the day Tim Berners Lee
>got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xalan-dev-help@xml.apache.org
>
>
>  
>


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


Re: Problem with empty text nodes in XSLTC transformation of DOM

Posted by Joseph Kesselman <ke...@us.ibm.com>.



The XPath data model does not distinguish <C/> from <C></C>, I'm afraid.
There is no such thing as an empty text node when running Xalan.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


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