ytalwar     2005/03/10 15:24:11

  Modified:    java/src/org/apache/xml/serializer ToStream.java
  Log:
  This patch fixes XALANJ-1431.
  The patch has been reviewed by Brian.
  
  The problem is that that when an empty attribute value is encountered, a text 
node is being created 
  with empty string. 
  Henry Zongaro has helped finding the XSLT 1.0 specs. that suggest a text node 
with empty string should not be created. URL http://www.w3.org/TR/xslt#value-of 
has the following information: 
  
  "The xsl:value-of element is instantiated to create a text node in the result 
tree. The required select attribute is an expression; this expression is 
evaluated and the resulting object is converted to a string as if by a call to 
the string function. The string specifies the string-value of the created text 
node. If the string is empty, no text node will be created. The created text 
node will be merged with any adjacent text nodes." 
  
  Revision  Changes    Path
  1.41      +6 -2      
xml-xalan/java/src/org/apache/xml/serializer/ToStream.java
  
  Index: ToStream.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/serializer/ToStream.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ToStream.java     2 Mar 2005 23:08:08 -0000       1.40
  +++ ToStream.java     10 Mar 2005 23:24:10 -0000      1.41
  @@ -1371,7 +1371,11 @@
       public void characters(final char chars[], final int start, final int 
length)
           throws org.xml.sax.SAXException
       {
  -        if (m_inEntityRef && !m_expandDTDEntities)
  +        // It does not make sense to continue with rest of the method if the 
number of 
  +        // characters to read from array is 0.
  +        // Section 7.6.1 of XSLT 1.0 (http://www.w3.org/TR/xslt#value-of) 
suggest no text node
  +        // is created if string is empty.    
  +        if (length == 0 || (m_inEntityRef && !m_expandDTDEntities))
               return;
           if (m_elemContext.m_startTagOpen)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to