cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp XSLTExtension.java
Date Sat, 06 Apr 2002 18:07:29 GMT
vgritsenko    02/04/06 10:07:29

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        XSLTExtension.java
  Log:
  allow national characters in the XSP
  
  Revision  Changes    Path
  1.2       +24 -3     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSLTExtension.java
  
  Index: XSLTExtension.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSLTExtension.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTExtension.java	8 Mar 2002 04:08:53 -0000	1.1
  +++ XSLTExtension.java	6 Apr 2002 18:07:29 -0000	1.2
  @@ -55,7 +55,7 @@
    * generation stylesheet to escape XML characters to make a valid Java strings.
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: XSLTExtension.java,v 1.1 2002/03/08 04:08:53 vgritsenko Exp $
  + * @version CVS $Id: XSLTExtension.java,v 1.2 2002/04/06 18:07:29 vgritsenko Exp $
    */
   public class XSLTExtension {
   
  @@ -78,17 +78,38 @@
                   case '\n':
                       buffer.append("\\n");
                       break;
  +                case '\b':
  +                    buffer.append("\\b");
  +                    break;
  +                case '\f':
  +                    buffer.append("\\f");
  +                    break;
                   case '"':
                   case '\\':
                       buffer.append('\\');
  -                    // Fall through
  -                default:
                       buffer.append(chr[i]);
                       break;
  +                default:
  +                    if (' ' <= chr[i] && chr[i] <= 127) {
  +                        buffer.append(chr[i]);
  +                    } else {
  +                        buffer.append("\\u");
  +                        buffer.append(int2digit(chr[i] >> 12));
  +                        buffer.append(int2digit(chr[i] >> 8));
  +                        buffer.append(int2digit(chr[i] >> 4));
  +                        buffer.append(int2digit(chr[i]));
  +                    }
  +                    break;
               }
           }
   
           return buffer.toString();
  +    }
  +
  +    private static char int2digit(int x) {
  +        x &= 0xF;
  +        if (x <= 9) return (char)(x + '0');
  +        else return (char)(x - 10 + 'A');
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message