cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap ActNodeBuilder.java ActTypeNode.java ActionSetNode.java ActionSetNodeBuilder.java
Date Thu, 07 Aug 2003 08:42:20 GMT
sylvain     2003/08/07 01:42:20

  Modified:    src/blocks/databases/samples/tutorial sitemap.xmap
               src/java/org/apache/cocoon/components/treeprocessor
                        DefaultTreeBuilder.java TreeBuilder.java
               src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        ActNodeBuilder.java ActTypeNode.java
                        ActionSetNode.java ActionSetNodeBuilder.java
  Added:       src/blocks/databases/samples/tutorial apache.xsl
  Log:
  Fix bug #9835 (hopefully) related to nested actions in action-sets
  
  Revision  Changes    Path
  1.3       +10 -3     cocoon-2.1/src/blocks/databases/samples/tutorial/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/databases/samples/tutorial/sitemap.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sitemap.xmap	25 Mar 2003 17:10:36 -0000	1.2
  +++ sitemap.xmap	7 Aug 2003 08:42:20 -0000	1.3
  @@ -82,7 +82,8 @@
       <map:serialize/>
     </map:act>
     <map:generate type="serverpages" src="docs/{1}-dept.xsp"/>
  -  <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/>
  +  <map:transform src="apache.xsl"/>
  +  <!--map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/-->
     <map:serialize/>
   </map:match>
   
  @@ -94,14 +95,20 @@
       <map:serialize/>
     </map:act>
     <map:generate type="serverpages" src="docs/{1}-empl.xsp"/>
  -  <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/>
  +  <map:transform src="apache.xsl"/>
  +  <!--map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/-->
     <map:serialize/>
   </map:match>
   
     <map:match pattern="**.html">
       <map:generate src="docs/{1}.xml"/>
  -    <map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/>
  +  <map:transform src="apache.xsl"/>
  +    <!--map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl"/-->
       <map:serialize/>
  +  </map:match>
  +  
  +  <map:match pattern="images/**">
  +    <map:read src="context://docs/{0}"/>
     </map:match>
   
     </map:pipeline>
  
  
  
  1.1                  cocoon-2.1/src/blocks/databases/samples/tutorial/apache.xsl
  
  Index: apache.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- Author: Berin Loritsch "bloritsch@infoplanning.com" -->
  <!-- Version: 1.0 -->
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="document">
      <html>
        <head>
          <title><xsl:value-of select="document/header/title"/></title>
          <xsl:if test="@redirect">
            <meta http-equiv="Refresh" content="{@time};URL={@redirect}"/>
          </xsl:if>
        </head>
        <body text="#000000" link="#039acc" vlink="#0086b2" alink="#cc0000"
              topmargin="4" leftmargin="4" marginwidth="4" marginheight="4"
              bgcolor="#ffffff">
          <!-- THE TOP BAR (HEADER) -->
          <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
              <td width="135" height="60" rowspan="3" valign="top" align="left">
                <img width="135" height="60" src="images/logo.gif" hspace="0" vspace="0"
border="0"/>
              </td>
              <td width="100%" height="5" valign="top" align="left" colspan="2" background="images/line.gif">
                <img width="1" height="5" src="images/line.gif" hspace="0" vspace="0" border="0"
align="left"/>
              </td>
              <td width="29" height="60"  rowspan="3" valign="top" align="left">
                <img width="29" height="60" src="images/right.gif" hspace="0" vspace="0"
border="0"/>
              </td>
            </tr>
            <tr>
              <td width="100%" height="35" valign="top" align="left" colspan="2" bgcolor="#0086b2"><font
size="5" face="arial,helvetica,sanserif" color="#ffffff"><div style="text-align: right;"><xsl:value-of
select="header/title"/></div></font></td>
            </tr>
            <tr>
              <td width="100%" height="20" valign="top" align="left" bgcolor="#0086b2"
background="images/bottom.gif">
                <img width="3" height="20" src="images/bottom.gif" hspace="0" vspace="0"
border="0" align="left"/>
              </td>
              <td align="right" bgcolor="#0086b2" height="20" valign="top" width="288"
background="images/bottom.gif">
                <table border="0" cellpadding="0" cellspacing="0" width="288">
                  <tr>
                    <td width="96" height="20" valign="top" align="left">
                      <a href="http://xml.apache.org/" target="new">
                        <img alt="http://xml.apache.org/" width="96" height="20" src="images/button-xml-lo.gif"
                             name="xml" hspace="0" vspace="0" border="0"/>
                      </a>
                    </td>
                    <td width="96" height="20" valign="top" align="left">
                      <a href="http://www.apache.org/" target="new">
                        <img alt="http://www.apache.org/" width="96" height="20" src="images/button-asf-lo.gif"
                             name="asf" hspace="0" vspace="0" border="0"/>
                      </a>
                    </td>
                    <td width="96" height="20" valign="top" align="left">
                      <a href="http://www.w3.org/" target="new">
                        <img alt="http://www.w3.org/" width="96" height="20" src="images/button-w3c-lo.gif"
                             name="w3c" hspace="0" vspace="0" border="0"/>
                      </a>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
          
          <!-- THE MAIN PANEL (SIDEBAR AND CONTENT) -->
          <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
              <!-- THE SIDE BAR -->
              <td width="120" valign="top" align="left">
                <div width="120" style="background-color: #a0a0a0;">
                  <font face="arial,helvetica,sanserif" color="#ffffff" size="-1">
                  <img width="120" height="14" src="images/join.gif" hspace="0" vspace="0"
border="0"/><br/>
                  <xsl:apply-templates select="document('../menu.xml')"/>
                  <img width="120" height="14" src="images/close.gif" hspace="0" vspace="0"
border="0"/><br/>
                  </font>
                </div>
              </td>
              <!-- THE CONTENT PANEL -->
              <td width="*" valign="top" align="left">
                <table border="0" cellspacing="0" cellpadding="3">
                  <tr><td><br/><xsl:apply-templates/></td></tr>
                </table>
              </td>
            </tr>
          </table>
          
          <br/>
          
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr><td bgcolor="#0086b2"><img src="images/dot.gif" width="1" height="1"/></td></tr>
            <tr>
              <td align="center"><font face="arial,helvetica,sanserif" size="-1"
color="#0086b2"><i>
                Copyright &#169; 1999-2001.
                All Rights Reserved.
              </i></font></td>
            </tr>
          </table>
        </body>
      </html>
    </xsl:template>
  
    <xsl:template match="body">
      <xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="menu">
      <xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="group">
      <a class="menu" href="{@link}"><font size="+1" color="#ffff80"><xsl:value-of
select="@title"/></font></a><br/>
      <xsl:apply-templates select="item"/>
    </xsl:template>
  
    <xsl:template match="item">
      <a class="menu" href="{@link}"><font color="#ffffff"><xsl:value-of select="@title"/></font></a><br/>
    </xsl:template>
  
    <xsl:template match="flash">
      <div align="center">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
id="{@id}" height="{@height}" width="{@width}">
        <param value="{@movie}" name="movie"/>
        <param value="{@quality}" name="quality"/>
        <param value="{@bg}" name="bgcolor"/>
        <embed src="{@movie}" quality="{@quality}" bgcolor="{@bg}" height="{@height}" width="{@width}"
type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"/>
      </object>
      </div><p/>
    </xsl:template>
  
    <xsl:template match="header"/>
  
    <xsl:template match="s1">
     <div align="right">
      <table border="0" width="98%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="9" height="7" valign="bottom" align="right"><img src="images/bar-top-left.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-top.gif"><img src="images/void.gif" width="1"
height="5" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="7" valign="bottom" align="left"><img src="images/bar-top-right.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" background="images/bar-border-left.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
          <td width="100%" bgcolor="#0086b2">
            <font size="+1" face="arial,helvetica,sanserif" color="#ffffff">
              <img src="images/void.gif" width="5" height="5" vspace="0" hspace="0" border="0"/><b><xsl:value-of
select="@title"/></b></font>
           </td>
          <td width="9" background="images/bar-border-right.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" height="12" valign="top" align="right"><img src="images/bar-bottom-left.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-bottom.gif"><img src="images/void.gif"
height="12" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="12" valign="top" align="left"><img src="images/bar-bottom-right.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
        </tr>
       </table>
       <table border="0" width="98%" cellspacing="0" cellpadding="0">
        <tr>
         <td>
          <font face="arial,helvetica,sanserif" color="#000000"><xsl:apply-templates/></font>
         </td>
        </tr>
      </table>
     </div>
     <br/>
    </xsl:template>
  
    <xsl:template match="s2">
     <div align="right">
      <table border="0" width="95%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="9" height="7" valign="bottom" align="right"><img src="images/bar-top-left.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-top.gif"><img src="images/void.gif" width="1"
height="5" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="7" valign="bottom" align="left"><img src="images/bar-top-right.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" background="images/bar-border-left.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
          <td width="100%" bgcolor="#0086b2">
            <font face="arial,helvetica,sanserif" color="#ffffff">
              <img src="images/void.gif" width="5" height="5" vspace="0" hspace="0" border="0"/><b><xsl:value-of
select="@title"/></b></font>
           </td>
          <td width="9" background="images/bar-border-right.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" height="12" valign="top" align="right"><img src="images/bar-bottom-left.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-bottom.gif"><img src="images/void.gif"
width="1" height="12" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="12" valign="top" align="left"><img src="images/bar-bottom-right.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
        </tr>
       </table>
       <table border="0" width="95%" cellspacing="0" cellpadding="0">
        <tr>
         <td>
          <font face="arial,helvetica,sanserif" color="#000000"><xsl:apply-templates/></font>
         </td>
        </tr>
      </table>
     </div>
     <br/>
    </xsl:template>
  
    <xsl:template match="s3">
     <div align="right">
      <table border="0" width="90%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="9" height="7" valign="bottom" align="right"><img src="images/bar-top-left.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-top.gif"><img src="images/void.gif" width="1"
height="5" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="7" valign="bottom" align="left"><img src="images/bar-top-right.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" background="images/bar-border-left.gif"><img src="iamges/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
          <td width="100%" bgcolor="#0086b2">
            <font size="-1" face="arial,helvetica,sanserif" color="#ffffff">
              <img src="images/void.gif" width="5" height="5" vspace="0" hspace="0" border="0"/><b><xsl:value-of
select="@title"/></b></font>
           </td>
          <td width="9" background="images/bar-border-right.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" height="12" valign="top" align="right"><img src="images/bar-bottom-left.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-bottom.gif"><img src="images/void.gif"
width="1" height="12" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="12" valign="top" align="left"><img src="images/bar-bottom-right.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
        </tr>
       </table>
       <table border="0" width="90%" cellspacing="0" cellpadding="0">
        <tr>
         <td>
          <font face="arial,helvetica,sanserif" color="#000000"><xsl:apply-templates/></font>
         </td>
        </tr>
      </table>
     </div>
     <br/>
    </xsl:template>
  
    <xsl:template match="s4">
     <div align="right">
      <table border="0" width="85%" cellspacing="0" cellpadding="0">
        <tr>
          <td width="9" height="7" valign="bottom" align="right"><img src="images/bar-top-left.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-top.gif"><img src="images/void.gif" width="1"
height="5" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="7" valign="bottom" align="left"><img src="images/bar-top-right.gif"
width="9" height="7" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" background="images/bar-border-left.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
          <td width="100%" bgcolor="#0086b2">
            <font size="-2" face="arial,helvetica,sanserif" color="#ffffff">
              <img src="images/void.gif" width="5" height="5" vspace="0" hspace="0" border="0"/><b><xsl:value-of
select="@title"/></b></font>
           </td>
          <td width="9" background="images/bar-border-right.gif"><img src="images/void.gif"
width="9" height="1" vspace="0" hspace="0" border="0"/></td>
        </tr>
        <tr>
          <td width="9" height="12" valign="top" align="right"><img src="images/bar-bottom-left.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
          <td background="images/bar-border-bottom.gif"><img src="images/void.gif"
width="1" height="12" vspace="0" hspace="0" border="0"/></td>
          <td width="9" height="12" valign="top" align="left"><img src="images/bar-bottom-right.gif"
width="9" height="12" vspace="0" hspace="0" border="0"/></td>
        </tr>
       </table>
       <table border="0" width="85%" cellspacing="0" cellpadding="0">
        <tr>
         <td>
          <font face="arial,helvetica,sanserif" color="#000000"><xsl:apply-templates/></font>
         </td>
        </tr>
      </table>
     </div>
     <br/>
    </xsl:template>
    
    <xsl:template match="form">
      <form name="form_{@name}" action="{@handler}" method="POST">
        <xsl:apply-templates/>
      </form>
    </xsl:template>
  
    <xsl:template match="submit">
      <input type="submit" name="cocoon-action-{@name}" value="{@name}"/>
    </xsl:template>
  
    <xsl:template match="reset">
      <input type="reset" value="{@name}"/>
    </xsl:template>
    
    <xsl:template match="parameter">
      <input type="hidden" name="{@name}" value="{@value}"/>
    </xsl:template>
    
    <xsl:template match="radio">
      <xsl:for-each select="option">
        <xsl:choose>
          <xsl:when test="position()=1">
            <input type="radio" name="{../@group}" value="{@value}" checked="true"/>
          </xsl:when>
          <xsl:otherwise>
            <input type="radio" name="{../@group}" value="{@value}"/>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:value-of select="."/><br/>
      </xsl:for-each>
    </xsl:template>
  
    <xsl:template match="text">
      <xsl:choose>
        <xsl:when test="@required='true'">
          <span style="color: #ff0000;">*</span>
        </xsl:when>
        <xsl:otherwise>&#160;</xsl:otherwise>
      </xsl:choose>
      <input type="text" name="{@name}" size="{@size}" value="{@value}"/>
    </xsl:template>
    
    <xsl:template match="check">
      <xsl:element name="input">
        <xsl:attribute name="type">checkbox</xsl:attribute>
        <xsl:attribute name="value">1</xsl:attribute>
        <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
        <xsl:if test="@checked='true'">
          <xsl:attribute name="checked"/>
        </xsl:if>
      </xsl:element>
    </xsl:template>
    
    <xsl:template match="p">
      <p align="justify"><xsl:apply-templates/></p>
    </xsl:template>
  
    <xsl:template match="note">
     <p>
      <table width="100%" cellspacing="3" cellpadding="0" border="0">
        <tr>
          <td width="28" valign="top">
            <img src="images/note.gif" width="28" height="29" vspace="0" hspace="0" border="0"
alt="Note"/>
          </td>
          <td valign="top">
            <font size="-1" face="arial,helvetica,sanserif" color="#000000">
              <i>
                <xsl:apply-templates/>
              </i>
            </font>
          </td>
        </tr>  
      </table>
     </p>
    </xsl:template>
  
    <xsl:template match="source">
     <div align="center">
      <table cellspacing="4" cellpadding="0" border="0">
      <tr>
        <td bgcolor="#0086b2" width="1" height="1"><img src="images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#0086b2" height="1"><img src="images/void.gif" width="1" height="1"
vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#0086b2" width="1" height="1"><img src="images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#0086b2" width="1"><img src="images/void.gif" width="1" height="1"
vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#ffffff"><pre><xsl:apply-templates/></pre></td>
        <td bgcolor="#0086b2" width="1"><img src="images/void.gif" width="1" height="1"
vspace="0" hspace="0" border="0"/></td>
      </tr>
      <tr>
        <td bgcolor="#0086b2" width="1" height="1"><img src="images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#0086b2" height="1"><img src="images/void.gif" width="1" height="1"
vspace="0" hspace="0" border="0"/></td>
        <td bgcolor="#0086b2" width="1" height="1"><img src="images/void.gif" width="1"
height="1" vspace="0" hspace="0" border="0"/></td>
      </tr>
      </table>
     </div>
    </xsl:template>
  
   <xsl:template match="figure">
    <p align="center"><img src="{@src}" alt="{@alt}" border="0" vspace="4" hspace="4"/></p>
   </xsl:template>
   
   <xsl:template match="img">
     <img src="{@src}" alt="{@alt}" border="0" vspace="4" hspace="4" align="right"/>
   </xsl:template>
  
   <xsl:template match="icon">
     <img src="{@src}" alt="{@alt}" border="0" align="absmiddle"/>
   </xsl:template>
  
    <xsl:template match="footer"/>
  
    <xsl:template match="fixme"/>
  
   <xsl:template match="ul|ol|dl">
    <blockquote>
     <xsl:copy>
      <xsl:apply-templates/>
     </xsl:copy>
    </blockquote>
   </xsl:template>
   
   <xsl:template match="li">
    <xsl:copy>
     <xsl:apply-templates/>
    </xsl:copy>
   </xsl:template>
  
   <xsl:template match="sl">
    <ul>
     <xsl:apply-templates/>
    </ul>
   </xsl:template>
  
   <xsl:template match="dt">
    <li>
     <strong><xsl:value-of select="."/></strong>
     <xsl:text> - </xsl:text>
     <xsl:apply-templates select="dd"/>   
    </li>
   </xsl:template>
  
    <xsl:template match="table">
      <table width="100%" border="0" cellspacing="2" cellpadding="2">
        <caption><xsl:value-of select="caption"/></caption>
        <xsl:apply-templates/>
      </table>
    </xsl:template>
  
    <xsl:template match="tr">
      <tr><xsl:apply-templates/></tr>
    </xsl:template>
  
    <xsl:template match="th">
      <td bgcolor="#039acc" colspan="{@colspan}" rowspan="{@rowspan}" valign="center" align="center">
        <font color="#ffffff" size="-1" face="arial,helvetica,sanserif">
          <b><xsl:apply-templates/></b>&#160;
        </font>
      </td>
    </xsl:template>
  
    <xsl:template match="td">
      <td bgcolor="#a0ddf0" colspan="{@colspan}" rowspan="{@rowspan}" valign="top" align="left">
        <font color="#000000" size="-1" face="arial,helvetica,sanserif">
          <xsl:apply-templates/>&#160;
        </font>
      </td>
    </xsl:template>
  
    <xsl:template match="tn">
      <td bgcolor="#ffffff" colspan="{@colspan}" rowspan="{@rowspan}">
        &#160;
      </td>
    </xsl:template>
    
    <xsl:template match="caption"/>
  
    <xsl:template match="overview">
      <div class="ovw"><xsl:apply-templates/></div>
    </xsl:template>
  
    <xsl:template match="quote">
      <div class="ctr"><xsl:apply-templates/></div>
    </xsl:template>
  
    <xsl:template match="rule">
      <br/><img src="images/hstrip.gif" width="364" height="18"/><br/>
    </xsl:template>
  
   <xsl:template match="link">
     <a href="{@href}"><xsl:apply-templates/></a>
   </xsl:template>
  
   <xsl:template match="connect">
    <xsl:apply-templates/>
   </xsl:template>
  
   <xsl:template match="jump">
     <a href="{@href}#{@anchor}"><xsl:apply-templates/></a>
   </xsl:template>
  
   <xsl:template match="fork">
     <a href="{@href}" target="_blank"><xsl:apply-templates/></a>
   </xsl:template>
  
   <xsl:template match="anchor">
     <a name="{@id}"><xsl:comment>anchor</xsl:comment></a>
   </xsl:template>  
  
   <xsl:template match="strong">
     <b><xsl:apply-templates/></b>
   </xsl:template>
  
   <xsl:template match="em">
      <i><xsl:apply-templates/></i>
   </xsl:template>
  
   <xsl:template match="code">
      <code><font face="courier, monospaced"><xsl:apply-templates/></font></code>
   </xsl:template>
   
    <xsl:template match="connect">
      <xsl:apply-templates/>
    </xsl:template>
  
    <xsl:template match="bottom">
      <div class="bot"><xsl:apply-templates/></div>
    </xsl:template>
  
    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.3       +11 -1     cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java
  
  Index: DefaultTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/DefaultTreeBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultTreeBuilder.java	28 Jul 2003 12:55:45 -0000	1.2
  +++ DefaultTreeBuilder.java	7 Aug 2003 08:42:20 -0000	1.3
  @@ -94,6 +94,8 @@
   public class DefaultTreeBuilder extends AbstractLogEnabled implements TreeBuilder,
     Recomposable, Configurable, Contextualizable, LogKitManageable, RoleManageable, Recyclable,
Disposable {
   
  +    protected Map attributes = new HashMap();
  +
       /**
        * The tree processor that we're building.
        */
  @@ -194,6 +196,14 @@
           this.namespace = config.getChild("namespace").getAttribute("uri", "");
   
           this.parameterElement = config.getChild("parameter").getAttribute("element", "parameter");
  +    }
  +
  +    public void setAttribute(String name, Object value) {
  +        this.attributes.put(name, value);
  +    }
  +    
  +    public Object getAttribute(String name) {
  +        return this.attributes.get(name);
       }
   
       /**
  
  
  
  1.3       +11 -1     cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java
  
  Index: TreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/TreeBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TreeBuilder.java	28 Jul 2003 12:55:45 -0000	1.2
  +++ TreeBuilder.java	7 Aug 2003 08:42:20 -0000	1.3
  @@ -139,4 +139,14 @@
        * Return the sitemap component manager
        */
       ComponentManager getSitemapComponentManager();
  +    
  +    /**
  +     * Add an attribute. Useful to transmit information between distant (in the tree) node
builders
  +     */
  +    void setAttribute(String name, Object value);
  +    
  +    /**
  +     * Get the value of an attribute.
  +     */
  +    Object getAttribute(String name);
   }
  
  
  
  1.3       +21 -2     cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActNodeBuilder.java
  
  Index: ActNodeBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActNodeBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ActNodeBuilder.java	29 Jul 2003 14:29:10 -0000	1.2
  +++ ActNodeBuilder.java	7 Aug 2003 08:42:20 -0000	1.3
  @@ -73,10 +73,24 @@
       private String      actSetName;
   
       public ProcessingNode buildNode(Configuration config) throws Exception {
  +        
  +        boolean inActionSet = this.treeBuilder.getAttribute(ActionSetNodeBuilder.IN_ACTION_SET)
!= null;
   
           // Is it an action-set call ?
           this.actSetName = config.getAttribute("set", null);
           if (actSetName == null) {
  +            
  +            if (inActionSet) {
  +                // Check that children are only parameters or actions
  +                Configuration children[] = config.getChildren();
  +                for (int i = 0; i < children.length; i++) {
  +                    String name = children[i].getName();
  +                    if (!"act".equals(name) && !"parameter".equals(name)) {
  +                        throw new ConfigurationException("An action set can only contain
actions and not '" 
  +                            + name + "' at " + children[i].getLocation());
  +                    }
  +                }
  +            }
   
               String name = config.getAttribute("name", null);
               String source = config.getAttribute("src", null);
  @@ -85,7 +99,8 @@
               ActTypeNode actTypeNode = new ActTypeNode(
                   type,
                   VariableResolverFactory.getResolver(source, this.manager),
  -                name
  +                name,
  +                inActionSet
               );
               this.treeBuilder.setupNode(actTypeNode, config);
   
  @@ -94,6 +109,10 @@
               return actTypeNode;
   
           } else {
  +
  +            if (inActionSet) {
  +                throw new ConfigurationException("Cannot call an action set from an action
set at " + config.getLocation());
  +            }
   
               // Action set call
               if (config.getAttribute("src", null) != null) {
  
  
  
  1.2       +22 -6     cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActTypeNode.java
  
  Index: ActTypeNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActTypeNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActTypeNode.java	9 Mar 2003 00:09:20 -0000	1.1
  +++ ActTypeNode.java	7 Aug 2003 08:42:20 -0000	1.2
  @@ -95,10 +95,13 @@
   
       protected ComponentManager manager;
   
  -    public ActTypeNode(String type, VariableResolver source, String name) throws PatternException
{
  +    protected boolean inActionSet;
  +
  +    public ActTypeNode(String type, VariableResolver source, String name, boolean inActionSet)
throws PatternException {
           super(type);
           this.source = source;
           this.name = name;
  +        this.inActionSet = inActionSet;
       }
   
       public void setParameters(Map parameterMap) {
  @@ -131,13 +134,12 @@
           // If action is ThreadSafe, avoid select() and try/catch block (faster !)
           if (this.threadSafeAction != null) {
               actionResult = this.threadSafeAction.act(
  -                redirector, resolver, objectModel, resolvedSource, resolvedParams );
  -
  +                redirector, resolver, objectModel, resolvedSource, resolvedParams);
           } else {
               Action action = (Action)this.selector.select(this.componentName);
               try {
                   actionResult = action.act(
  -                redirector, resolver, objectModel, resolvedSource, resolvedParams );
  +                redirector, resolver, objectModel, resolvedSource, resolvedParams);
   
               } finally {
                   this.selector.release(action);
  @@ -155,7 +157,21 @@
           } else {
               // Action succeeded : process children if there are some, with the action result
               if (this.children != null) {
  -                return this.invokeNodes(this.children, env, context, name, actionResult);
  +                boolean result = this.invokeNodes(this.children, env, context, name, actionResult);
  +                
  +                if (inActionSet) {
  +                    // Merge child action results, if any
  +                    Map childMap = (Map)env.getAttribute(ActionSetNode.ACTION_RESULTS);
  +                    if (childMap != null) {
  +                        childMap.putAll(actionResult);
  +                    } else {
  +                        // No previous results
  +                        env.setAttribute(ActionSetNode.ACTION_RESULTS, actionResult);
  +                    }
  +                }
  +                
  +                return result;
  +
   
               } else {
                   // Return false to continue sitemap invocation
  
  
  
  1.2       +29 -82    cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActionSetNode.java
  
  Index: ActionSetNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActionSetNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionSetNode.java	9 Mar 2003 00:09:20 -0000	1.1
  +++ ActionSetNode.java	7 Aug 2003 08:42:20 -0000	1.2
  @@ -50,24 +50,18 @@
   */
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
  -import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.ComponentSelector;
  -import org.apache.avalon.framework.component.Composable;
  +import java.util.HashMap;
  +import java.util.Map;
  +
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.cocoon.acting.Action;
   import org.apache.cocoon.components.treeprocessor.InvokeContext;
   import org.apache.cocoon.components.treeprocessor.NamedProcessingNode;
  +import org.apache.cocoon.components.treeprocessor.ProcessingNode;
   import org.apache.cocoon.components.treeprocessor.SimpleSelectorProcessingNode;
  -import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
   
  -import java.util.HashMap;
  -import java.util.Map;
  -
   /**
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  @@ -75,46 +69,22 @@
    */
   
   public class ActionSetNode extends SimpleSelectorProcessingNode
  -  implements Disposable, NamedProcessingNode, Composable {
  +  implements NamedProcessingNode {
  +      
  +    public static final String CALLER_PARAMETERS = ActionSetNode.class.getName() + "/CallerParameters";
  +    public static final String ACTION_RESULTS = ActionSetNode.class.getName() + "/ActionResults";
   
  -    /** The action types */
  -    private String[] types;
  +    /** The action nodes */
  +    private ProcessingNode[] nodes;
   
       /** The 'action' attribute for each action */
       private String[] actionNames;
   
  -    /** The actions that are ThreadSafe, to avoid lookups */
  -    private Action[] threadSafeActions;
  -
  -    /** The src for each action */
  -    private VariableResolver[] sources;
  -
  -    /** The parameters for each action */
  -    private Map[] parameters;
  -
  -    /** The component manager */
  -    protected ComponentManager manager;
  -
       public ActionSetNode(
  -      String name, String[] types, String[] actionNames,
  -      VariableResolver[] sources, Map[] parameters) {
  +      String name, ProcessingNode[] nodes, String[] actionNames) {
           super(name);
  -        this.types = types;
  +        this.nodes = nodes;
           this.actionNames = actionNames;
  -        this.sources = sources;
  -        this.parameters = parameters;
  -    }
  -
  -    public void compose(ComponentManager manager) throws ComponentException {
  -        this.manager = manager;
  -        setSelector((ComponentSelector)manager.lookup(Action.ROLE + "Selector"));
  -
  -        // Get all actions that are thread safe
  -        this.threadSafeActions = new Action[types.length];
  -
  -        for (int i = 0; i < this.types.length; i++) {
  -            this.threadSafeActions[i] = (Action)this.getThreadSafeComponent(this.types[i]);
  -        }
       }
   
       public final boolean invoke(Environment env, InvokeContext context)
  @@ -139,44 +109,30 @@
   
           String cocoonAction = env.getAction();
   
  +        // Store the parameters from the caller into the environment so that they can be
merged with
  +        // each action's parameters.
  +        
  +
           Map result = null;
   
           // Call each action that either has no cocoonAction, or whose cocoonAction equals
           // the one from the environment.
  +        env.setAttribute(CALLER_PARAMETERS, params);
   
  -        for (int i = 0; i < types.length; i++) {
  +        for (int i = 0; i < nodes.length; i++) {
   
  -            Map actionResult;
  -            Action action;
   
               String actionName = actionNames[i];
  -            String source = sources[i].resolve(context, objectModel);
               if (actionName == null || actionName.equals(cocoonAction)) {
  -
  -                Parameters actionParams = VariableResolver.buildParameters(parameters[i],
context, objectModel);
  -                if (actionParams == Parameters.EMPTY_PARAMETERS) {
  -                    actionParams = params;
  -                } else {
  -                    actionParams.merge(params);
  -                }
  -
  -                // If action is ThreadSafe, avoid select() and try/catch block (faster
!)
  -                if ((action = this.threadSafeActions[i]) != null) {
  -
  -                    actionResult = action.act(
  -                        redirector, resolver, objectModel, source, actionParams);
  -
  -                } else {
  -
  -                    action = (Action)this.selector.select(this.types[i]);
  -                    try {
  -                        actionResult = action.act(
  -                            redirector, resolver, objectModel, source, actionParams);
  -                    } finally {
  -                        this.selector.release(action);
  -                    }
  -                }
  -
  +                
  +                this.nodes[i].invoke(env, context);
  +                
  +                // Get action results. They're passed back through the environment since
action-sets
  +                // "violate" the tree hierarchy (the returned Map is visible outside of
the node)
  +                Map actionResult = (Map)env.getAttribute(ACTION_RESULTS);
  +                // Don't forget to clear it
  +                env.removeAttribute(ACTION_RESULTS);
  +                
                   if (actionResult != null) {
                       // Merge the result in the global result, creating it if necessary.
                       if (result == null) {
  @@ -185,20 +141,11 @@
                           result.putAll(actionResult);
                       }
                   }
  +                
               } // if (actionName...
           } // for (int i...
   
           return result;
  -    }
  -
  -    public void dispose() {
  -
  -        // Dispose ThreadSafe actions
  -        for (int i = 0; i < this.threadSafeActions.length; i++) {
  -            this.selector.release(this.threadSafeActions[i]);
  -        }
  -        
  -        this.manager.release(this.selector);        
       }
   
       /**
  
  
  
  1.2       +26 -33    cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActionSetNodeBuilder.java
  
  Index: ActionSetNodeBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ActionSetNodeBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionSetNodeBuilder.java	9 Mar 2003 00:09:20 -0000	1.1
  +++ ActionSetNodeBuilder.java	7 Aug 2003 08:42:20 -0000	1.2
  @@ -50,69 +50,62 @@
   */
   package org.apache.cocoon.components.treeprocessor.sitemap;
   
  +import java.util.ArrayList;
  +import java.util.List;
  +
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.thread.ThreadSafe;
  -
  -import org.apache.cocoon.acting.Action;
  -
  +import org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder;
   import org.apache.cocoon.components.treeprocessor.AbstractProcessingNodeBuilder;
  -import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
  -import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
   import org.apache.cocoon.components.treeprocessor.ProcessingNode;
   
  -import java.util.*;
  -
   /**
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Id$
    */
   
  -public class ActionSetNodeBuilder extends AbstractProcessingNodeBuilder implements ThreadSafe
{
  +public class ActionSetNodeBuilder extends AbstractParentProcessingNodeBuilder implements
ThreadSafe {
  +    
  +    /** The TreeBuilder attribute indicating that an ActionSet is being built */
  +    public static final String IN_ACTION_SET = ActionSetNodeBuilder.class.getName() + "/inActionSet";
   
       public ProcessingNode buildNode(Configuration config) throws Exception {
   
           String actionSetName = config.getAttribute("name");
   
  -        // Lists of action types, names and sources for each map:act
  -        List actionTypes  = new ArrayList();
  +        // Lists of action types and nodes for each map:act
           List actionNames  = new ArrayList();
  -        List actionSources = new ArrayList();
  -        List actionParameters = new ArrayList();
  -
  +        List actionNodes = new ArrayList();
  +        
           Configuration[] childrenConfig = config.getChildren();
  +        // Inform other builders that we're in an action-set
  +        this.treeBuilder.setAttribute(IN_ACTION_SET, Boolean.TRUE);
  +        
  +        // Get the child actions
  +        ProcessingNode[] nodes = this.buildChildNodes(config);
  +        
  +        // And get their names
  +        String[] actions = new String[nodes.length];
           for (int i = 0; i < childrenConfig.length; i++) {
  -
               Configuration childConfig = childrenConfig[i];
               String name = childConfig.getName();
   
               if ("act".equals(name)) {
  -
  -                checkNamespace(childConfig);
  -                String type = this.treeBuilder.getTypeForStatement(childConfig, Action.ROLE
+ "Selector");
  -
  -                actionTypes.add(type);
  -                actionNames.add(childConfig.getAttribute("action", null));
  -                actionSources.add(VariableResolverFactory.getResolver(
  -                    childConfig.getAttribute("src", null), this.manager));
  -                actionParameters.add(this.getParameters(childConfig));
  -
  +                actions[i] = childConfig.getAttribute("action", null);
               } else {
                   // Unknown element
                   String msg = "Unknown element " + name + " in action-set at " + childConfig.getLocation();
                   throw new ConfigurationException(msg);
  -            }
  +            }            
           }
   
  -        String[] types   = (String[])actionTypes.toArray(new String[actionTypes.size()]);
  -        String[] actions = (String[])actionNames.toArray(new String[actionNames.size()]);
  -        Map[]    parameters = (Map[])actionParameters.toArray(new Map[actionParameters.size()]);
  -        VariableResolver[] sources =
  -            (VariableResolver[])actionSources.toArray(new VariableResolver[actionSources.size()]);
  -
  -        ActionSetNode node = new ActionSetNode(actionSetName, types, actions, sources,
parameters);
  +        ActionSetNode node = new ActionSetNode(actionSetName, nodes, actions);
           this.treeBuilder.setupNode(node, config);
  +
  +        // Inform other builders that we're no more in an action-set
  +        this.treeBuilder.setAttribute(IN_ACTION_SET, null);
   
           return node;
       }
  
  
  

Mime
View raw message