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/programming/javascript JavascriptLanguage.java
Date Fri, 08 Mar 2002 04:08:53 GMT
vgritsenko    02/03/07 20:08:53

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        JSGenerator.java XSPGenerator.java
                        XSPObjectHelper.java
               src/java/org/apache/cocoon/components/language/markup/xsp/java
                        xsp.xsl
               src/java/org/apache/cocoon/components/language/markup/xsp/javascript
                        xsp.xsl
               src/java/org/apache/cocoon/components/language/programming/java
                        JavaLanguage.java
               src/java/org/apache/cocoon/components/language/programming/javascript
                        JavascriptLanguage.java
  Added:       src/java/org/apache/cocoon/components/language/markup/xsp
                        XSLTExtension.java
  Removed:     src/java/org/apache/cocoon/components/language/markup/xsp/java
                        XSLTExtension.java
  Log:
  fix bug with xsp:param: ignore text inside xsp:param if xsp:expr tag is present;
  minor cleanup.
  
  Revision  Changes    Path
  1.8       +4 -70     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java
  
  Index: JSGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JSGenerator.java	6 Mar 2002 03:05:23 -0000	1.7
  +++ JSGenerator.java	8 Mar 2002 04:08:53 -0000	1.8
  @@ -87,7 +87,7 @@
    * written in Javascript language
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: JSGenerator.java,v 1.7 2002/03/06 03:05:23 vgritsenko Exp $
  + * @version CVS $Id: JSGenerator.java,v 1.8 2002/03/08 04:08:53 vgritsenko Exp $
    */
   public class JSGenerator extends XSPGenerator
           implements Configurable, Initializable {
  @@ -140,7 +140,7 @@
               global = new ImporterTopLevel(context);
               global.put("page", global, Context.toObject(this, global));
               global.put("logger", global, Context.toObject(getLogger(), global));
  -            global.put("jsAttr", global, Context.toObject(new AttributesImpl(), global));
  +            global.put("xspAttr", global, Context.toObject(new AttributesImpl(), global));
   
               context.setOptimizationLevel(-1);
   
  @@ -206,78 +206,12 @@
       public void dispose() {
           global.delete("page");
           global.delete("logger");
  -        global.delete("jsAttr");
  +        global.delete("xspAttr");
           this.global = null;
           this.script = null;
  +        this.compileError = null;
   
           super.dispose();
  -    }
  -
  -    // Helper methods accessible from script
  -
  -    /**
  -     * Add an attribute
  -     *
  -     * @param attr The attribute list to add to
  -     * @param name The attribute name
  -     * @param value The attribute value
  -     */
  -    public void jsAttribute(AttributesImpl attr, String name, String value) {
  -        attr.addAttribute("", name, name, "CDATA", value);
  -    }
  -
  -    /**
  -     * Start an element
  -     *
  -     * @param name The element name
  -     * @param attr The element attributes
  -     */
  -    public void jsStart(String name, AttributesImpl attr) throws SAXException {
  -        this.contentHandler.startElement("", name, name, attr);
  -        attr.clear();
  -    }
  -
  -    /**
  -     * End an element
  -     *
  -     * @param name The element name
  -     */
  -    public void jsEnd(String name) throws SAXException {
  -        this.contentHandler.endElement("", name, name);
  -    }
  -
  -    /**
  -     * Add character data
  -     *
  -     * @param data The character data
  -     */
  -    public void jsCharacters(String data) throws SAXException {
  -        this.contentHandler.characters(data.toCharArray(), 0, data.length());
  -    }
  -
  -    /**
  -     * Add a comment
  -     *
  -     * @param comment The comment data
  -     */
  -    public void jsComment(String comment) throws SAXException {
  -        this.lexicalHandler.comment(comment.toCharArray(), 0, comment.length());
  -    }
  -
  -    // XSPObjectHelper
  -
  -    public void jsExpr(Object v) throws SAXException {
  -        if (v == null || v instanceof String) {
  -            XSPObjectHelper.xspExpr(this.contentHandler, (String) v);
  -        } else if (v instanceof Collection) {
  -            XSPObjectHelper.xspExpr(this.contentHandler, (Collection) v);
  -        } else if (v instanceof XMLizable) {
  -            XSPObjectHelper.xspExpr(this.contentHandler, (XMLizable) v);
  -        } else if (v instanceof Node) {
  -            XSPObjectHelper.xspExpr(this.contentHandler, (Node) v);
  -        } else if (v instanceof Object) {
  -            XSPObjectHelper.xspExpr(this.contentHandler, (Object) v);
  -        }
       }
   
       // XSPRequestHelper
  
  
  
  1.7       +47 -1     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPGenerator.java
  
  Index: XSPGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPGenerator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XSPGenerator.java	22 Feb 2002 07:00:08 -0000	1.6
  +++ XSPGenerator.java	8 Mar 2002 04:08:53 -0000	1.7
  @@ -60,12 +60,18 @@
   
   import org.apache.cocoon.components.language.generator.CompiledComponent;
   import org.apache.cocoon.generation.AbstractServerPage;
  +import org.apache.cocoon.xml.XMLizable;
  +
  +import org.xml.sax.SAXException;
  +import org.w3c.dom.Node;
  +
  +import java.util.Collection;
   
   /**
    * Base class for XSP-generated <code>ServerPagesGenerator</code> classes
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Id: XSPGenerator.java,v 1.6 2002/02/22 07:00:08 cziegeler Exp $
  + * @version CVS $Id: XSPGenerator.java,v 1.7 2002/03/08 04:08:53 vgritsenko Exp $
    */
   public abstract class XSPGenerator extends AbstractServerPage implements CompiledComponent,
Contextualizable, Recyclable {
       protected Context avalonContext = null;
  @@ -83,5 +89,45 @@
        */
       public void compose(ComponentManager manager) throws ComponentException {
           super.compose(manager);
  +    }
  +
  +    // XSP Helper methods accessible from the page
  +
  +    /**
  +     * Add character data
  +     *
  +     * @param data The character data
  +     */
  +    public void xspCharacters(String data) throws SAXException {
  +        this.contentHandler.characters(data.toCharArray(), 0, data.length());
  +    }
  +
  +    /**
  +     * Add a comment
  +     *
  +     * @param comment The comment data
  +     */
  +    public void xspComment(String comment) throws SAXException {
  +        this.lexicalHandler.comment(comment.toCharArray(), 0, comment.length());
  +    }
  +
  +    /**
  +     * Implementation of &lt;xsp:expr&gt; for String, Collection,
  +     * XMLizable, Node, and Object.
  +     *
  +     * @param v the value
  +     */
  +    public void xspExpr(Object v) throws SAXException {
  +        if (v == null || v instanceof String) {
  +            XSPObjectHelper.xspExpr(this.contentHandler, (String) v);
  +        } else if (v instanceof Collection) {
  +            XSPObjectHelper.xspExpr(this.contentHandler, (Collection) v);
  +        } else if (v instanceof XMLizable) {
  +            XSPObjectHelper.xspExpr(this.contentHandler, (XMLizable) v);
  +        } else if (v instanceof Node) {
  +            XSPObjectHelper.xspExpr(this.contentHandler, (Node) v);
  +        } else if (v instanceof Object) {
  +            XSPObjectHelper.xspExpr(this.contentHandler, (Object) v);
  +        }
       }
   }
  
  
  
  1.6       +2 -2      xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java
  
  Index: XSPObjectHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSPObjectHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSPObjectHelper.java	22 Feb 2002 07:00:08 -0000	1.5
  +++ XSPObjectHelper.java	8 Mar 2002 04:08:53 -0000	1.6
  @@ -67,7 +67,7 @@
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
    *         (Cocoon1 <code>xspExpr()</code> methods port)
  - * @version CVS $Id: XSPObjectHelper.java,v 1.5 2002/02/22 07:00:08 cziegeler Exp $
  + * @version CVS $Id: XSPObjectHelper.java,v 1.6 2002/03/08 04:08:53 vgritsenko Exp $
    */
   public class XSPObjectHelper {
     /**
  @@ -287,7 +287,7 @@
      * outputs characters representing the value.
      *
      * @param contentHandler the SAX content handler
  -   * @param v the value
  +   * @param text the value
      */
     public static void xspExpr(ContentHandler contentHandler, String text) throws SAXException
     {
  
  
  
  1.1                  xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/XSLTExtension.java
  
  Index: XSLTExtension.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.language.markup.xsp;
  
  /**
   * This class is used as a XSLT extension class. It is used by the XSP
   * 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 $
   */
  public class XSLTExtension {
  
      /**
       * Escapes '"' and '\' characters in a String (add a '\' before them) so that it can
       * be inserted in java source.
       */
      public static String escapeString(String string) {
          char chr[] = string.toCharArray();
          StringBuffer buffer = new StringBuffer();
  
          for (int i = 0; i < chr.length; i++) {
              switch (chr[i]) {
                  case '\t':
                      buffer.append("\\t");
                      break;
                  case '\r':
                      buffer.append("\\r");
                      break;
                  case '\n':
                      buffer.append("\\n");
                      break;
                  case '"':
                  case '\\':
                      buffer.append('\\');
                      // Fall through
                  default:
                      buffer.append(chr[i]);
                      break;
              }
          }
  
          return buffer.toString();
      }
  
      /**
       * Escapes '"' and '\' characters in a String (add a '\' before them) so that it can
       * be inserted in java source.
       */
      public String escape(String string) {
          return escapeString(string);
      }
  
      /**
       * Counts amount of spaces in the input line from the beginning
       * to the first new line symbol and returns a string with this
       * amount of spaces.
       */
      public String prefix(String string) {
          char chr[] = string.toCharArray();
          int i;
          for (i = 0; i < chr.length; i++) {
              if (chr[i] == '\n' || chr[i] == '\r')
                  break;
          }
          if (i == chr.length) {
              return "";
          }
  
          int j = 0;
          for (; i < chr.length; i++) {
              if (chr[i] == '\n' || chr[i] == '\r') {
                  j = 0;
              } else if (!Character.isSpaceChar(chr[i])) {
                  break;
              } else {
                  j ++;
              }
          }
  
          // System.out.println("<" + string + "> prefix:" + j);
          StringBuffer buffer = new StringBuffer();
          for (i = 0; i < j; i++) {
              buffer.append(' ');
          }
          return buffer.toString();
      }
  
      /**
       * Counts amount of spaces in the input line from the end
       * to the last new line symbol and returns a string with this
       * amount of spaces.
       */
      public String suffix(String string) {
          char chr[] = string.toCharArray();
  
          int j = 0;
          for (int i = chr.length-1; i >=0; i--) {
              if (chr[i] == '\n' || chr[i] == '\r')
                  break;
              if (!Character.isSpaceChar(chr[i]))
                  return "";
              j ++;
          }
  
          // System.out.println("<" + string + "> suffix:" + j);
          StringBuffer buffer = new StringBuffer();
          for (int i = 0; i < j; i++) {
              buffer.append(' ');
          }
          return buffer.toString();
      }
  }
  
  
  
  1.7       +15 -5     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl
  
  Index: xsp.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- xsp.xsl	24 Feb 2002 20:08:22 -0000	1.6
  +++ xsp.xsl	8 Mar 2002 04:08:53 -0000	1.7
  @@ -1,6 +1,6 @@
   <?xml version="1.0"?>
   
  -<!-- $Id: xsp.xsl,v 1.6 2002/02/24 20:08:22 vgritsenko Exp $-->
  +<!-- $Id: xsp.xsl,v 1.7 2002/03/08 04:08:53 vgritsenko Exp $-->
   <!--
   
    ============================================================================
  @@ -57,13 +57,13 @@
    *
    * @author <a href="mailto:ricardo@apache.org>Ricardo Rocha</a>
    * @author <a href="sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
  - * @version CVS $Revision: 1.6 $ $Date: 2002/02/24 20:08:22 $
  + * @version CVS $Revision: 1.7 $ $Date: 2002/03/08 04:08:53 $
   -->
   
   <xsl:stylesheet version="1.0"
                   xmlns:xsp="http://apache.org/xsp"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  -                xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension">
  +                xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension">
     <xsl:output method="text"/>
   
     <xsl:variable name="xsp-uri" select="'http://apache.org/xsp'"/>
  @@ -78,7 +78,7 @@
     <xsl:variable
          name="extension"
          select="XSLTExtension:new()"
  -       xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension"/>
  +       xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension"/>
   
     <xsl:template match="/">
       <code xml:space="preserve">
  @@ -512,7 +512,7 @@
       <xsl:choose>
         <xsl:when test="@*[name(.) = $name]">"<xsl:value-of select="@*[name(.) =
$name]"/>"</xsl:when>
         <xsl:when test="(*[namespace-uri(.)=$xsp-uri and local-name(.) = 'param'])[@name
= $name]">
  -        <xsl:call-template name="get-nested-content">
  +        <xsl:call-template name="get-parameter-content">
             <xsl:with-param name="content"
                             select="(*[namespace-uri(.)=$xsp-uri and local-name(.) = 'param'])[@name
= $name]"/>
           </xsl:call-template>
  @@ -534,6 +534,16 @@
             <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
           </xsl:choose>
         </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xsl:template name="get-parameter-content">
  +    <xsl:param name="content"/>
  +    <xsl:choose>
  +      <xsl:when test="$content/*[namespace-uri(.)=$xsp-uri and local-name(.) != 'text']">
  +        <xsl:apply-templates select="$content/*[namespace-uri(.)=$xsp-uri and local-name(.)
!= 'text']"/>
  +      </xsl:when>
  +      <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
       </xsl:choose>
     </xsl:template>
   
  
  
  
  1.4       +25 -15    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/xsp.xsl
  
  Index: xsp.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/javascript/xsp.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- xsp.xsl	21 Feb 2002 02:42:49 -0000	1.3
  +++ xsp.xsl	8 Mar 2002 04:08:53 -0000	1.4
  @@ -1,6 +1,6 @@
   <?xml version="1.0"?>
   
  -<!-- $Id: xsp.xsl,v 1.3 2002/02/21 02:42:49 vgritsenko Exp $-->
  +<!-- $Id: xsp.xsl,v 1.4 2002/03/08 04:08:53 vgritsenko Exp $-->
   <!--
    *****************************************************************************
    * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  @@ -15,13 +15,13 @@
    * XSP Core logicsheet for the JavaScript language
    *
    * @author <a href="mailto:vgritsenko@apache.org>Vadim Gritsenko</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2002/02/21 02:42:49 $
  + * @version CVS $Revision: 1.4 $ $Date: 2002/03/08 04:08:53 $
   -->
   
   <xsl:stylesheet version="1.0"
                   xmlns:xsp="http://apache.org/xsp"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  -                xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension">
  +                xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension">
     <xsl:output method="text"/>
   
     <xsl:variable name="xsp-uri" select="'http://apache.org/xsp'"/>
  @@ -36,7 +36,7 @@
     <xsl:variable
          name="extension"
          select="XSLTExtension:new()"
  -       xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension"/>
  +       xmlns:XSLTExtension="org.apache.cocoon.components.language.markup.xsp.XSLTExtension"/>
   
     <xsl:template match="/">
       <code>
  @@ -60,7 +60,7 @@
       // page           - "this" in Java
       // logger         - Logger
       // contentHandler - page.contentHandler
  -    // jsAttr         - AttributesImpl
  +    // xspAttr        - AttributesImpl
   
       /* Built-in parameters available for use */
       // objectModel - Map
  @@ -177,8 +177,8 @@
       <xsl:apply-templates select="xsp:attribute | xsp:logic[xsp:attribute]"/>
   
       contentHandler.startElement(<xsl:copy-of select="$uri"/>,
  -      <xsl:copy-of select="$name"/>, <xsl:copy-of select="$raw-name"/>, jsAttr);
  -    jsAttr.clear();
  +      <xsl:copy-of select="$name"/>, <xsl:copy-of select="$raw-name"/>, xspAttr);
  +    xspAttr.clear();
   
       <xsl:apply-templates select="node()[not(
         (namespace-uri(.) = $xsp-uri and local-name(.) = 'attribute') or
  @@ -258,7 +258,7 @@
         </xsl:if>
       </xsl:variable>
   
  -    jsAttr.addAttribute(<xsl:copy-of select="$uri"/>,
  +    xspAttr.addAttribute(<xsl:copy-of select="$uri"/>,
         <xsl:copy-of select="$name"/>, <xsl:copy-of select="$raw-name"/>, "CDATA",
         <xsl:value-of select="normalize-space($content)"/>);
     </xsl:template>
  @@ -278,7 +278,7 @@
         </xsl:when>
         <xsl:otherwise>
           <!-- Output the value as elements or character data depending on its type -->
  -        page.jsExpr(<xsl:value-of select="."/>);
  +        page.xspExpr(<xsl:value-of select="."/>);
         </xsl:otherwise>
       </xsl:choose>
     </xsl:template>
  @@ -324,7 +324,7 @@
   
     <!-- FIXME: How to create comments in SAX? -->
     <xsl:template match="xsp:comment">
  -    page.jsComment("<xsl:value-of select="."/>");
  +    page.xspComment("<xsl:value-of select="."/>");
     </xsl:template>
   
   
  @@ -343,8 +343,8 @@
       <xsl:apply-templates select="xsp:attribute | xsp:logic[xsp:attribute]"/>
   
       contentHandler.startElement("<xsl:value-of select="namespace-uri(.)"/>",
  -      "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>",
jsAttr);
  -    jsAttr.clear();
  +      "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>",
xspAttr);
  +    xspAttr.clear();
   
       <xsl:apply-templates select="node()[not(
           (namespace-uri(.) = $xsp-uri and local-name(.) = 'attribute') or
  @@ -366,7 +366,7 @@
     <xsl:template match="@*">
       <!-- Filter out namespace declaration attributes -->
       <xsl:if test="not(starts-with(name(.), 'xmlns:'))">
  -    jsAttr.addAttribute("<xsl:value-of select="namespace-uri(.)"/>",
  +    xspAttr.addAttribute("<xsl:value-of select="namespace-uri(.)"/>",
         "<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>",
"CDATA",
         "<xsl:value-of select="."/>");
       </xsl:if>
  @@ -378,7 +378,7 @@
           <xsl:value-of select="."/>
         </xsl:when>
         <xsl:otherwise>
  -        page.jsCharacters("<xsl:value-of select="XSLTExtension:escape($extension, .)"/>");
  +        page.xspCharacters("<xsl:value-of select="XSLTExtension:escape($extension, .)"/>");
         </xsl:otherwise>
       </xsl:choose>
     </xsl:template>
  @@ -403,7 +403,7 @@
       <xsl:choose>
         <xsl:when test="@*[name(.) = $name]">"<xsl:value-of select="@*[name(.) =
$name]"/>"</xsl:when>
         <xsl:when test="(*[namespace-uri(.)=$xsp-uri and local-name(.) = 'param'])[@name
= $name]">
  -        <xsl:call-template name="get-nested-content">
  +        <xsl:call-template name="get-parameter-content">
             <xsl:with-param name="content"
                             select="(*[namespace-uri(.)=$xsp-uri and local-name(.) = 'param'])[@name
= $name]"/>
           </xsl:call-template>
  @@ -425,6 +425,16 @@
             <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
           </xsl:choose>
         </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +
  +  <xsl:template name="get-parameter-content">
  +    <xsl:param name="content"/>
  +    <xsl:choose>
  +      <xsl:when test="$content/*[namespace-uri(.)=$xsp-uri and local-name(.) != 'text']">
  +        <xsl:apply-templates select="$content/*[namespace-uri(.)=$xsp-uri and local-name(.)
!= 'text']"/>
  +      </xsl:when>
  +      <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
       </xsl:choose>
     </xsl:template>
   
  
  
  
  1.10      +7 -8      xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java
  
  Index: JavaLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JavaLanguage.java	22 Feb 2002 07:00:09 -0000	1.9
  +++ JavaLanguage.java	8 Mar 2002 04:08:53 -0000	1.10
  @@ -60,7 +60,7 @@
   
   import org.apache.cocoon.components.classloader.ClassLoaderManager;
   import org.apache.cocoon.components.language.LanguageException;
  -import org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension;
  +import org.apache.cocoon.components.language.markup.xsp.XSLTExtension;
   import org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage;
   import org.apache.cocoon.components.language.programming.CompilerError;
   import org.apache.cocoon.util.ClassUtils;
  @@ -75,7 +75,7 @@
    * The Java programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Id: JavaLanguage.java,v 1.9 2002/02/22 07:00:09 cziegeler Exp $
  + * @version CVS $Id: JavaLanguage.java,v 1.10 2002/03/08 04:08:53 vgritsenko Exp $
    */
   public class JavaLanguage extends CompiledProgrammingLanguage
           implements Initializable, ThreadSafe, Composable, Disposable {
  @@ -112,7 +112,7 @@
        * sitemap-specified <code>ClassLoaderManager</code>
        *
        * @param params The configuration parameters
  -     * @exception Exception If the class loader manager cannot be instantiated
  +     * @exception ParameterException If the class loader manager cannot be instantiated
        */
       public void parameterize(Parameters params) throws ParameterException {
           super.parameterize(params);
  @@ -172,7 +172,7 @@
       /**
        * Actually load an object program from a class file.
        *
  -     * @param filename The object program base file name
  +     * @param name The object program base file name
        * @param baseDirectory The directory containing the object program file
        * @return The loaded object program
        * @exception LanguageException If an error occurs during loading
  @@ -190,7 +190,7 @@
       /**
        * Compile a source file yielding a loadable class file.
        *
  -     * @param filename The object program base file name
  +     * @param name The object program base file name
        * @param baseDirectory The directory containing the object program file
        * @param encoding The encoding expected in the source file or
        * <code>null</code> if it is the platform's default encoding
  @@ -209,9 +209,8 @@
               String pathname =
                       baseDirectory.getCanonicalPath() + File.separator +
                       name.substring(0, pos).replace(File.separatorChar, '/');
  -            String filename_abs =
  -                    new StringBuffer(pathname).append(File.separator).append(filename)
  -                    .append(".").append(this.getSourceExtension()).toString();
  +            String filename_abs = pathname + File.separator + filename
  +                    + "." + this.getSourceExtension();
   
               compiler.setFile(filename_abs);
               compiler.setSource(pathname);
  
  
  
  1.9       +2 -2      xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
  
  Index: JavascriptLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JavascriptLanguage.java	22 Feb 2002 07:00:10 -0000	1.8
  +++ JavascriptLanguage.java	8 Mar 2002 04:08:53 -0000	1.9
  @@ -51,7 +51,7 @@
   package org.apache.cocoon.components.language.programming.javascript;
   
   import org.apache.cocoon.components.language.LanguageException;
  -import org.apache.cocoon.components.language.markup.xsp.java.XSLTExtension;
  +import org.apache.cocoon.components.language.markup.xsp.XSLTExtension;
   import org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage;
   import org.apache.cocoon.components.language.programming.Program;
   import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
  @@ -73,7 +73,7 @@
    * The class specified will be used as a Java wrapper interpreting javascript program.
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: JavascriptLanguage.java,v 1.8 2002/02/22 07:00:10 cziegeler Exp $
  + * @version CVS $Id: JavascriptLanguage.java,v 1.9 2002/03/08 04:08:53 vgritsenko Exp $
    */
   public class JavascriptLanguage extends AbstractProgrammingLanguage implements ProgrammingLanguage
{
   
  
  
  

----------------------------------------------------------------------
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