You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Yash Talwar (JIRA)" <xa...@xml.apache.org> on 2005/03/16 20:31:24 UTC

[jira] Created: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

XSLTC does ignores non-whitespaces as if they were whitespaces.
---------------------------------------------------------------

         Key: XALANJ-2081
         URL: http://issues.apache.org/jira/browse/XALANJ-2081
     Project: XalanJ2
        Type: Bug
  Components: XSLTC  
    Versions: CurrentCVS    
 Environment: Windows 2000
    Reporter: Yash Talwar
 Assigned to: Yash Talwar 
     Fix For: CurrentCVS


Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.

Example 1:
==========
Stylesheet:
------------
<?xml version="1.1" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" version="1.1" encoding="UTF-8" />
  <xsl:template match="/">
    <out>&#x08;&#x1F;</out>
  </xsl:template>
</xsl:stylesheet>


Input XML: 
-------------
<?xml version="1.1"?>
<doc />

Output using Xalan Interpretive:
--------------------------------
<?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>


Output using XSLTC:
-------------------
<?xml version="1.1" encoding="UTF-8"?><out/>

Here, Xalan Interpretive has correct ouptut.


Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.

Just look at following snippet of java code:

		System.out.println(Character.isWhitespace((char)0x08));
		System.out.println(Character.isWhitespace((char)0x1f));
		String s = "\u0008\u001f";
		System.out.println(s.trim().length());
		
The output for this code snippet is:

               false
               true
               0       // The length here should not be 0.

This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.

I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text

The following line of code is the probematic:

 if (_text.trim().length() == 0) _ignore = true;
 
In above sample, it can be seen that trim() method is problematic.
 
I will attach a patch to fix this problem.

Yash Talwar


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Yash Talwar (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=history ]
     
Yash Talwar resolved XALANJ-2081:
---------------------------------

    Resolution: Fixed

XalanJ2081_Patch3.txt commited to cvs.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt, XalanJ2081_Patch2.txt, XalanJ2081_Patch3.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Michael Glavassevich (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=comments#action_61003 ]
     
Michael Glavassevich commented on XALANJ-2081:
----------------------------------------------

The only characters which are considered to be spaces in XML are 0x09 (TAB), 0x0A (LF), 0x0D (CR) and 0x20 (SPACE). Character.isWhitespace() will return true for many characters which aren't XML spaces such as 0x1F.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=history ]

Brian Minchau updated XALANJ-2081:
----------------------------------

    Xalan info: [PatchAvailable]
      reviewer: minchau@ca.ibm.com

Assigning myself as reviewer.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Yash Talwar (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=history ]

Yash Talwar updated XALANJ-2081:
--------------------------------

    Attachment: XalanJ2081_Patch2.txt

As per Michael's comments, a new patch is attached here.
Yash Talwar

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt, XalanJ2081_Patch2.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Yash Talwar (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=history ]

Yash Talwar updated XALANJ-2081:
--------------------------------

    Attachment: XalanJ2081_Patch.txt

Here is the patch to resolve this issue.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=history ]

Brian Minchau updated XALANJ-2081:
----------------------------------

    Attachment: XalanJ2081_Patch3.txt

Attaching Patch3, a minor update of Patch2, which simply adds the static keyword to the isWhitespace(char) method.

I have reviewed and approve Patch3.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt, XalanJ2081_Patch2.txt, XalanJ2081_Patch3.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=all ]

Brian Minchau updated XALANJ-2081:
----------------------------------

    Fix Version: 2.7
                     (was: CurrentCVS)

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: 2.7
>  Attachments: XalanJ2081_Patch.txt, XalanJ2081_Patch2.txt, XalanJ2081_Patch3.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XALANJ-2081?page=comments#action_12319277 ] 

Brian Minchau commented on XALANJ-2081:
---------------------------------------

Yash, please confirm that this is fixed in 2.7 and close this issue.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: Latest Development Code
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: 2.7
>  Attachments: XalanJ2081_Patch.txt, XalanJ2081_Patch2.txt, XalanJ2081_Patch3.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XALANJ-2081) XSLTC does ignores non-whitespaces as if they were whitespaces.

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2081?page=comments#action_61031 ]
     
Brian Minchau commented on XALANJ-2081:
---------------------------------------

Looking at the serializer code, it has comments about using a check like this:
if(    (ch1 = chars[i]) == 0x20
    || (ch1 == 0xA && m_lineSepUse)
    ||  ch1 == 0xD
    ||  ch1 == 0x09))

rather than calling isWhitespace(ch1).  Of course from what Michael writes, it looks like this isn't the same, and the serializer is doing the right thing.  The serializers m_lineSepUse flag is true by default, and seems never to be modified.

> XSLTC does ignores non-whitespaces as if they were whitespaces.
> ---------------------------------------------------------------
>
>          Key: XALANJ-2081
>          URL: http://issues.apache.org/jira/browse/XALANJ-2081
>      Project: XalanJ2
>         Type: Bug
>   Components: XSLTC
>     Versions: CurrentCVS
>  Environment: Windows 2000
>     Reporter: Yash Talwar
>     Assignee: Yash Talwar
>      Fix For: CurrentCVS
>  Attachments: XalanJ2081_Patch.txt
>
> Given following stylesheet and input document, Xalan Interpretive and XSLTC has difference in output.
> Example 1:
> ==========
> Stylesheet:
> ------------
> <?xml version="1.1" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:output method="xml" version="1.1" encoding="UTF-8" />
>   <xsl:template match="/">
>     <out>&#x08;&#x1F;</out>
>   </xsl:template>
> </xsl:stylesheet>
> Input XML: 
> -------------
> <?xml version="1.1"?>
> <doc />
> Output using Xalan Interpretive:
> --------------------------------
> <?xml version="1.1" encoding="UTF-8"?><out>&#8;&#31;</out>
> Output using XSLTC:
> -------------------
> <?xml version="1.1" encoding="UTF-8"?><out/>
> Here, Xalan Interpretive has correct ouptut.
> Here #x08 is a backspace character.  XSLTC treats both characters as whitespace characters.
> Just look at following snippet of java code:
> 		System.out.println(Character.isWhitespace((char)0x08));
> 		System.out.println(Character.isWhitespace((char)0x1f));
> 		String s = "\u0008\u001f";
> 		System.out.println(s.trim().length());
> 		
> The output for this code snippet is:
>                false
>                true
>                0       // The length here should not be 0.
> This shows that 0x08 is not a whitespace character, but trim() method of java.lang.String treats it as a whitespace character.
> I believe the problem lies in the class org.apache.xalan.xsltc.compiler.Text
> The following line of code is the probematic:
>  if (_text.trim().length() == 0) _ignore = true;
>  
> In above sample, it can be seen that trim() method is problematic.
>  
> I will attach a patch to fix this problem.
> Yash Talwar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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