cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/java logicsheet-util.xsl util.xsl
Date Sun, 14 Jul 2002 15:07:31 GMT
haul        2002/07/14 08:07:31

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp/java
                        Tag: cocoon_2_0_3_branch logicsheet-util.xsl
                        util.xsl
  Log:
  backport fix util.xsl
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.1   +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.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- logicsheet-util.xsl	27 Feb 2002 05:26:41 -0000	1.4
  +++ logicsheet-util.xsl	14 Jul 2002 15:07:31 -0000	1.4.2.1
  @@ -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')"/>
  
  
  
  1.4.2.1   +41 -83    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.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- util.xsl	21 Feb 2002 03:36:09 -0000	1.4
  +++ util.xsl	14 Jul 2002 15:07:31 -0000	1.4.2.1
  @@ -65,6 +65,9 @@
     xmlns:xsp="http://apache.org/xsp"
     xmlns:util="http://apache.org/xsp/util/2.0"
   >
  +  <xsl:variable name="namespace-uri">http://apache.org/xsp/util/2.0</xsl:variable>
  +  <xsl:include href="logicsheet-util.xsl"/>
  +
     <xsl:template match="xsp:page">
       <xsp:page>
         <xsl:apply-templates select="@*"/>
  @@ -123,6 +126,36 @@
     </xsl:template>
     -->
   
  +  <xsl:template match="util:get-source">
  +    <xsl:variable name="source-uri">
  +      <xsl:call-template name="get-string-parameter">
  +        <xsl:with-param name="name">uri</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +    <xsp:expr>
  +      XSPUtil.getSourceAsString(<xsl:copy-of select="$source-uri"/>,this.resolver)
  +    </xsp:expr>
  +  </xsl:template>
  +
  +  <xsl:template match="util:include-source">
  +    <xsl:variable name="source-uri">
  +      <xsl:call-template name="get-string-parameter">
  +        <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>
  +      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">
  @@ -135,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">
  @@ -173,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>
   
  @@ -210,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>
   
  @@ -302,22 +277,5 @@
       </xsp:expr>
     </xsl:template>
   
  -  <!-- Standard Templates -->
  -  <xsl:template name="get-nested-content">
  -    <xsl:param name="content"/>
  -    <xsl:choose>
  -      <xsl:when test="$content/xsp:text">"<xsl:value-of select="$content"/>"</xsl:when>
  -      <xsl:when test="$content/*">
  -        <xsl:apply-templates select="$content/*"/>
  -      </xsl:when>
  -      <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise>
  -    </xsl:choose>
  -  </xsl:template>
  -
  -  <xsl:template match="@*|*|text()|processing-instruction()">
  -    <xsl:copy>
  -      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
  -    </xsl:copy>
  -  </xsl:template>
   
   </xsl:stylesheet>
  
  
  

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