You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ha...@apache.org on 2002/07/14 16:49:03 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java util.xsl logicsheet-util.xsl

haul        2002/07/14 07:49:03

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp/java
                        util.xsl logicsheet-util.xsl
  Log:
  fix util.xsl
  
  Revision  Changes    Path
  1.6       +16 -77    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/util.xsl
  
  Index: util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/util.xsl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- util.xsl	22 May 2002 16:03:08 -0000	1.5
  +++ util.xsl	14 Jul 2002 14:49:03 -0000	1.6
  @@ -143,22 +143,19 @@
           <xsl:with-param name="name">uri</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
  +    <xsl:variable name="source-base">
  +      <xsl:call-template name="get-string-parameter">
  +        <xsl:with-param name="name">base</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
       <xsp:logic>
  -      {
  -         org.apache.cocoon.components.parser.Parser newParser = null;
  -         try {
  -            newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
  -            XSPUtil.include(this.resolver.resolve(<xsl:copy-of select="$source-uri"/>).getInputSource(), this.contentHandler, newParser);
  -          } catch (Exception e) {
  -              getLogger().error("Could not include source", e);
  -          } finally {
  -              if (newParser != null) this.manager.release((Component) newParser);
  -          }
  -      }
  +      XSPUtil.includeSource(<xsl:copy-of select="$source-uri"/>, <xsl:copy-of select="$source-base"/>, this.resolver, this.contentHandler);
       </xsp:logic>
     </xsl:template>
   
   
  +
  +
     <!-- Include URL contents as SAX -->
     <xsl:template match="util:include-uri">
       <xsl:variable name="href">
  @@ -171,31 +168,12 @@
           </xsl:when>
         </xsl:choose>
       </xsl:variable>
  -
  -    <xsp:logic> {
  -      String __name = String.valueOf(<xsl:copy-of select="$href"/>);
  -      {
  -          org.apache.cocoon.components.parser.Parser newParser = null;
  -          org.apache.cocoon.components.url.URLFactory factory = null;
  -
  -          try {
  -              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
  -              factory = (org.apache.cocoon.components.url.URLFactory) this.manager.lookup(org.apache.cocoon.components.url.URLFactory.ROLE);
  -              URL __url = factory.getURL(__name);
  -              InputSource __is = new InputSource(__url.openStream());
  -              __is.setSystemId(__url.toString());
  -
  -              XSPUtil.include(__is, this.contentHandler, newParser);
  -          } catch (Exception e) {
  -              getLogger().error("Could not include page", e);
  -          } finally {
  -              if (factory != null) this.manager.release((Component) factory);
  -              if (newParser != null) this.manager.release((Component) newParser);
  -          }
  -      }
  -    } </xsp:logic>
  +    <xsp:logic>
  +      XSPUtil.includeSource(<xsl:copy-of select="$href"/>, null, this.resolver, this.contentHandler);
  +    </xsp:logic>
     </xsl:template>
   
  +
      <!-- Include file contents as SAX -->
      <xsl:template match="util:include-file">
        <xsl:variable name="name">
  @@ -209,28 +187,7 @@
          </xsl:choose>
        </xsl:variable>
        <xsp:logic>
  -       {
  -          org.apache.cocoon.components.parser.Parser newParser = null;
  -
  -          try {
  -              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
  -              InputSource __is = new InputSource(
  -                      new FileReader(
  -                         XSPUtil.relativeFilename(
  -                           <xsl:copy-of select="$name"/>,
  -                           objectModel
  -                        )
  -                      )
  -                  );
  -
  -
  -              XSPUtil.include(__is, this.contentHandler, newParser);
  -            } catch (Exception e) {
  -              getLogger().error("Could not include page", e);
  -            } finally {
  -              if (newParser != null) this.manager.release((Component) newParser);
  -            }
  -       }
  +       XSPUtil.includeFile(<xsl:copy-of select="$name"/>,this.manager, this.contentHandler, objectModel);
        </xsp:logic>
      </xsl:template>
   
  @@ -246,25 +203,7 @@
       </xsl:variable>
   
       <xsp:logic>
  -      {
  -          org.apache.cocoon.components.parser.Parser newParser = null;
  -
  -          try {
  -              newParser = (org.apache.cocoon.components.parser.Parser) this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
  -              InputSource __is = new InputSource(
  -                      new StringReader(
  -                          String.valueOf(<xsl:copy-of select="$expr"/>)
  -                      )
  -                  );
  -
  -
  -              XSPUtil.include(__is, this.contentHandler, newParser);
  -          } catch (Exception e) {
  -              getLogger().error("Could not include page", e);
  -          } finally {
  -              if (newParser != null) this.manager.release((Component) newParser);
  -          }
  -      }
  +      XSPUtil.includeString(<xsl:copy-of select="$expr"/>,this.manager, this.contentHandler);
       </xsp:logic>
     </xsl:template>
   
  
  
  
  1.5       +12 -2     xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/logicsheet-util.xsl
  
  Index: logicsheet-util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java/logicsheet-util.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- logicsheet-util.xsl	27 Feb 2002 05:26:41 -0000	1.4
  +++ logicsheet-util.xsl	14 Jul 2002 14:49:03 -0000	1.5
  @@ -149,6 +149,11 @@
       <xsl:param name="default"/>
       <xsl:param name="required">false</xsl:param>
   
  +    <!-- for some unknown reason this needs to be called every time,
  +         otherwise only the first invocation uses a correct namespace
  +         prefix. -->
  +    <xsl:variable name="namespace-prefix"><xsl:call-template name="get-namespace-prefix"/></xsl:variable>
  +
       <xsl:variable name="qname">
         <xsl:value-of select="concat($namespace-prefix, ':param')"/>
       </xsl:variable>
  @@ -223,6 +228,11 @@
       <xsl:param name="name"/>
       <xsl:param name="default"/>
       <xsl:param name="required">false</xsl:param>
  +
  +    <!-- for some unknown reason this needs to be called every time,
  +         otherwise only the first invocation uses a correct namespace
  +         prefix. -->
  +    <xsl:variable name="namespace-prefix"><xsl:call-template name="get-namespace-prefix"/></xsl:variable>
   
       <xsl:variable name="qname">
         <xsl:value-of select="concat($namespace-prefix, ':param')"/>
  
  
  

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