You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gr...@locus.apache.org on 2000/11/20 23:37:26 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/transformer XalanTransformer.java

greenrd     00/11/20 14:37:26

  Modified:    .        changes.xml
               src/org/apache/cocoon/processor/xslt XSLTProcessor.java
               src/org/apache/cocoon/transformer XalanTransformer.java
  Log:
  fixed xslt to allow embedded stylesheets
  
  Revision  Changes    Path
  1.153     +4 -1      xml-cocoon/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/changes.xml,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- changes.xml	2000/11/20 18:35:55	1.152
  +++ changes.xml	2000/11/20 22:37:23	1.153
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes   
  -  $Id: changes.xml,v 1.152 2000/11/20 18:35:55 greenrd Exp $ 
  +  $Id: changes.xml,v 1.153 2000/11/20 22:37:23 greenrd Exp $ 
   -->
   
   <changes title="History of Changes">
  @@ -19,7 +19,10 @@
   
    <release version="@version@" date="@date@">
     <action dev="RDG" type="fix">
  -   Fixed response.sendRedirect problem with Tomcat
  +   Fixed XSLTProcessor and XalanTransformer to allow embedded stylesheets.
  +  </action>
  +  <action dev="RDG" type="fix">
  +   Fixed response.sendRedirect problem with Tomcat.
     </action>
     <action dev="RDG" type="update" due-to="Matt Sergeant"
      due-to-email="matt@sergeant.org">
  
  
  
  1.18      +7 -2      xml-cocoon/src/org/apache/cocoon/processor/xslt/XSLTProcessor.java
  
  Index: XSLTProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xslt/XSLTProcessor.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XSLTProcessor.java	2000/11/20 01:43:55	1.17
  +++ XSLTProcessor.java	2000/11/20 22:37:24	1.18
  @@ -1,4 +1,4 @@
  -/*-- $Id: XSLTProcessor.java,v 1.17 2000/11/20 01:43:55 greenrd Exp $ --
  +/*-- $Id: XSLTProcessor.java,v 1.18 2000/11/20 22:37:24 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -73,7 +73,7 @@
    * This class implements an XSLT processor.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.17 $ $Date: 2000/11/20 01:43:55 $
  + * @version $Revision: 1.18 $ $Date: 2000/11/20 22:37:24 $
    */
   
   public class XSLTProcessor implements Actor, Processor, Status, Defaults, Cacheable {
  @@ -107,7 +107,8 @@
               Object resource = getResource(context, request, document, path, browser);
               Document stylesheet = getStylesheet(resource, request);
               Document result = this.parser.createEmptyDocument();
  -            return transformer.transform(document, null, stylesheet, resource.toString(), result, params);
  +            return transformer.transform(document, path, stylesheet, 
  +              (resource == null) ? null : resource.toString(), result, params);
           } catch (PINotFoundException e) {
               return document;
           }
  @@ -165,7 +166,9 @@
                       Object local = null;
   
                       try {
  -                        if (url.charAt(0) == '/') {
  +                        if (url.charAt(0) == '#') {
  +                            return null;
  +                        } else if (url.charAt(0) == '/') {
                               local = new File(Utils.getRootpath(request, context) + url);
                           } else if (url.indexOf("://") < 0) {
                               local = new File(Utils.getBasepath(request, context) + url);
  @@ -201,6 +204,8 @@
       }
   
       private Document getStylesheet(Object resource, HttpServletRequest request) throws ProcessorException {
  +
  +        if (resource == null) return null;
   
           try {
               Object o = this.store.get(resource);
  
  
  
  1.14      +7 -2      xml-cocoon/src/org/apache/cocoon/transformer/XalanTransformer.java
  
  Index: XalanTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformer/XalanTransformer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XalanTransformer.java	2000/10/20 21:39:42	1.13
  +++ XalanTransformer.java	2000/11/20 22:37:25	1.14
  @@ -1,4 +1,4 @@
  -/*-- $Id: XalanTransformer.java,v 1.13 2000/10/20 21:39:42 greenrd Exp $ --
  +/*-- $Id: XalanTransformer.java,v 1.14 2000/11/20 22:37:25 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -69,7 +69,7 @@
    * Xalan XSLT processor.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.13 $ $Date: 2000/10/20 21:39:42 $
  + * @version $Revision: 1.14 $ $Date: 2000/11/20 22:37:25 $
    */
   
   public class XalanTransformer extends AbstractActor implements Transformer, Status {
  @@ -96,8 +96,13 @@
           XSLTInputSource i = new XSLTInputSource(in);
           // inBase needed for document function with 2 args to resolve correctly
           i.setSystemId(inBase);
  -        XSLTInputSource s = new XSLTInputSource(sheet);
  -        s.setSystemId(sheetBase);
  +
  +        XSLTInputSource s = null;
  +        if (sheet != null) {
  +          s = new XSLTInputSource(sheet);
  +          s.setSystemId(sheetBase);
  +        }
  +
           XSLTResultTarget o = new XSLTResultTarget(out);
           processor.process(i, s, o);
           return out;