coliver     2003/03/17 07:23:40

  Modified:    src/scratchpad/webapp/samples/petstore sitemap.xmap
               src/scratchpad/webapp/samples/petstore/flow petstore.js
  Added:       src/scratchpad/webapp/samples/petstore/stylesheets
                        site2html.xsl
               src/scratchpad/webapp/samples/petstore/view/xsp Cart.xsp
                        Category.xsp EditAccountForm.xsp Item.xsp
                        Product.xsp SearchProducts.xsp SignonForm.xsp
                        index.xsp
  Log:
  added leo leonid's xsp implementation of view
  
  Revision  Changes    Path
  1.3       +15 -5     cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sitemap.xmap      17 Mar 2003 00:37:19 -0000      1.2
  +++ sitemap.xmap      17 Mar 2003 15:23:39 -0000      1.3
  @@ -58,12 +58,22 @@
         </map:match>
     </map:pipeline>
   
  -    <map:pipeline>
  -   <map:match pattern="view/templates/*.vm">
  -    <map:generate src="view/templates/{1}.vm" type="flow_velocity"/>
  -    <map:serialize type="html"/>
  -   </map:match>
  +   <map:pipeline>
  +     <map:match pattern="view/*.html">
  +     <map:redirect-to uri="view/xsp/{1}.xsp">
      </map:pipeline>
  +   <map:pipeline>
  +     <map:match pattern="view/templates/*.vm">
  +      <map:generate src="view/templates/{1}.vm" type="flow_velocity"/>
  +      <map:serialize type="html"/>
  +     </map:match>
  +    <map:match pattern="view/xsp/*.xsp">
  +        <map:generate src="view/xsp/{1}.xsp" type="serverpages"/>
  +        <map:transform src="stylesheets/site2html.xsl" />
  +        <map:serialize type="html"/>
  +    </map:match>
  +   </map:pipeline>
  +            
   
      <map:pipeline>
      <map:match pattern="images/*.gif">
  
  
  
  1.4       +42 -22    
cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js
  
  Index: petstore.js
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- petstore.js       17 Mar 2003 04:51:52 -0000      1.3
  +++ petstore.js       17 Mar 2003 15:23:39 -0000      1.4
  @@ -92,7 +92,7 @@
   
   function index() {
       getPetStore();
  -    sendPage("view/templates/index.vm", {
  +    sendPage("/view/index.html", {
                accountForm: accountForm,
                categoryList: categoryList
       });
  @@ -101,10 +101,17 @@
   // Cart page
   
   function viewCart() {
  -    sendPage("view/templates/Cart.vm", {
  +    var cartItems = [];
  +    for (var i in cartForm.cart.cartItems) {
  +        var cartItem = cartForm.cart.cartItems[i];
  +     cartItems.push(cartItem);
  +    }
  +    sendPage("/view/Cart.html", {
                accountForm: accountForm, 
                cartForm: cartForm, 
  -             yoshi: yoshi
  +             yoshi: yoshi,
  +                           cartItems: cartItems
  +
       });
   }
   
  @@ -112,24 +119,32 @@
       var itemId = cocoon.request.getParameter("workingItemId");
       var item = getPetStore().getItem(itemId);
       cartForm.cart.removeItem(item);
  -    sendPage("view/templates/Cart.vm", {
  +    var cartItems = [];
  +    for (var i in cartForm.cart.cartItems) {
  +        var cartItem = cartForm.cart.cartItems[i];
  +     cartItems.push(cartItem);
  +    }
  +    sendPage("/view/Cart.html", {
                yoshi: yoshi, 
                accountForm: accountForm, 
  -             cartForm: cartForm
  +                     cartForm: cartForm, cartItems: cartItems
       });
   }
   
   function updateCartQuantities() {
  +    var cartItems = [];
       for (var i in cartForm.cart.cartItems) {
           var cartItem = cartForm.cart.cartItems[i];
           var itemId = cartItem.item.itemId;
           var quantity = new java.lang.Double(cocoon.request.get(itemId)).intValue();
           cartItem.updateQuantity(quantity);
  +     cartItems.push(cartItem);
       }
  -    sendPage("view/templates/Cart.vm", {
  +    sendPage("/view/Cart.html", {
                yoshi: yoshi, 
                accountForm: accountForm, 
  -             cartForm:cartForm
  +          cartForm:cartForm,
  +          cartItems: cartItems
       });
   }
   
  @@ -137,10 +152,15 @@
       var itemId = cocoon.request.getParameter("itemId");
       var item = getPetStore().getItem(itemId);
       cartForm.cart.addItem(item);
  -    sendPage("view/templates/Cart.vm", {
  +    var cartItems = [];
  +    for (var i in cartForm.cart.cartItems) {
  +        var cartItem = cartForm.cart.cartItems[i];
  +     cartItems.push(cartItem);
  +    }
  +    sendPage("/view/Cart.html", {
                yoshi: yoshi, 
                accountForm: accountForm, 
  -             cartForm:cartForm
  +                     cartForm:cartForm, cartItems: cartItems
       });
   }
   
  @@ -156,7 +176,7 @@
           var productList = getPetStore().getProductListByCategory(categoryId,
                                                                    skipResults, 
                                                                    maxResults);
  -        sendPageAndWait("view/templates/Category.vm", {
  +        sendPageAndWait("/view/Category.html", {
                           accountForm: accountForm, 
                           productList: productList.rows, 
                           category: category, 
  @@ -184,7 +204,7 @@
           var itemList = getPetStore().getItemListByProduct(productId,
                                                             skipResults, 
                                                             maxResults);
  -        sendPageAndWait("view/templates/Product.vm", {
  +        sendPageAndWait("/view/Product.html", {
                           accountForm: accountForm, 
                           yoshi: yoshi,
                           product: product,
  @@ -206,7 +226,7 @@
   function viewItem() {
       var itemId = cocoon.request.getParameter("itemId");
       var item = getPetStore().getItem(itemId);
  -    sendPage("view/templates/Item.vm", {
  +    sendPage("/view/Item.html", {
                accountForm: accountForm, 
                cartForm: cartForm, 
                item: item, 
  @@ -231,7 +251,7 @@
       } else {
           var message = "";
           while (true) {
  -            sendPageAndWait("view/templates/SignonForm.vm", {
  +            sendPageAndWait("/view/SignonForm.html", {
                               accountForm: accountForm, 
                               message: message
               });
  @@ -257,7 +277,7 @@
       print("new account");
       var accountForm = new AccountForm();
       var account = new Account();
  -    sendPageAndWait("view/templates/NewAccountForm.vm", {
  +    sendPageAndWait("/view/NewAccountForm.html", {
                        accountForm: accountForm,
                        account: account,
                        categoryList: categoryList
  @@ -268,7 +288,7 @@
       if (accountForm.signOn) {
           newAccountForm();
       } else {
  -        sendPageAndWait("view/templates/EditAccountForm.vm", {
  +        sendPageAndWait("/view/EditAccountForm.html", {
                           accountForm: accountForm,
                           account: accountForm.account,
                           categoryList: categoryList
  @@ -281,7 +301,7 @@
   function searchProducts() {
       var keyword = cocoon.request.get("keyword");
       if (keyword == null || keyword == "") {
  -        sendPage("view/templates/Error.vm", {
  +        sendPage("/view/Error.html", {
              message: "Please enter a keyword to search for, then press the search 
button"
           });
           return;
  @@ -291,7 +311,7 @@
       while (true) {
           var result = getPetStore().searchProductList(keyword, skipResults,
                                                        maxResults);
  -        sendPageAndWait("view/templates/SearchProducts.vm", {
  +        sendPageAndWait("/view/SearchProducts.html", {
                           searchResultsProductList: result.rows,
                           firstPage: skipResults == 0,
                           lastPage: !result.isLimitedByMaxRows
  @@ -308,7 +328,7 @@
   // Checkout
   
   function checkout() {
  -    sendPageAndWait("view/templates/Checkout.vm", {
  +    sendPageAndWait("/view/Checkout.html", {
                       accountForm: accountForm,
                       cartForm: cartForm, 
                       yoshi: yoshi
  @@ -321,24 +341,24 @@
       var order = orderForm.order;
       var valid = false;
       while (!valid) {
  -        sendPageAndWait("view/templates/NewOrderForm.vm", { 
  +        sendPageAndWait("/view/NewOrderForm.html", { 
                           yoshi: yoshi,
                           creditCardTypes: ["Visa", "MasterCard", "American Express"],
                           order: order});
           var shippingAddressRequired = cocoon.request.get("shippingAddressRequired");
           if (shippingAddressRequired) {
  -            sendPageAndWait("view/templates/ShippingForm.vm",
  +            sendPageAndWait("/view/ShippingForm.html",
                               {order: order, yoshi: yoshi});
           }
           // fix me !! do real validation
           valid = true;
       }
  -    sendPageAndWait("view/templates/ConfirmOrder.vm",
  +    sendPageAndWait("/view/ConfirmOrder.html",
                       {order: order, yoshi: yoshi});
       
       var oldCartForm = cartForm;
       cartForm = new CartForm();
  -    sendPage("view/templates/ViewOrder.vm",
  +    sendPage("/view/ViewOrder.html",
                {order: order, itemList: order.lineItems, yoshi: yoshi});
   }
   
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/site2html.xsl
  
  Index: site2html.xsl
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  
  
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  
      <xsl:template match="site">
          <html>
              <head>
                  <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
                  <meta HTTP-EQUIV="Cache-Control" CONTENT="max-age=0"/>
                  <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache"/>
                  <meta http-equiv="expires" content="0"/>
                  <meta HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT"/>
                  <meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
              </head>
              <body bgcolor="white">
                  <table background="images/bkg-topbar.gif" border="0" cellspacing="0" 
cellpadding="5" width="100%">
                      <tbody>
                          <tr>
                              <td>
                                  <a href="index.do"><img border="0" 
src="images/logo-topbar.gif" /></a>
                              </td>
                              <td align="right">
                                  <a href="viewCart.do"><img border="0" 
name="img_cart" src="images/cart.gif" /></a><img border="0" src="images/separator.gif" 
/>
                                  <xsl:choose>
                                      <xsl:when test="@signOn='true'">
                                          <a href="signonForm.do"><img border="0" 
name="img_signin" src="images/sign-in.gif" /></a>
                                      </xsl:when>
                                      <xsl:otherwise>
                                          <a href="signonForm.do?signoff=true"><img 
border="0" name="img_signout" src="images/sign-out.gif" /></a><img border="0" 
src="images/separator.gif" />
                                          <a href="editAccountForm.do"><img border="0" 
name="img_myaccount" src="images/my_account.gif" /></a>
                                      </xsl:otherwise>
                                  </xsl:choose>
                                  <img border="0" src="images/separator.gif" /><a 
href="../help.html"><img border="0" name="img_help" src="images/help.gif" /></a>
                              </td>
                              <td align="left" valign="bottom">
                                  <form method="get" action="searchProducts.do">
                                      <input name="keyword" size="14" />
                                      <input border="0" src="images/search.gif" 
type="image" />
                                  </form>
                              </td>
                          </tr>
                      </tbody>
                  </table>
                  <center>
                      <a href="viewCategory.do?categoryId=FISH"><img border="0" 
src="images/sm_fish.gif" /></a> 
                      <img border="0" src="images/separator.gif" /> 
                      <a href="viewCategory.do?categoryId=DOGS"><img border="0" 
src="images/sm_dogs.gif" /></a> 
                      <img border="0" src="images/separator.gif" /> 
                      <a href="viewCategory.do?categoryId=REPTILES"><img border="0" 
src="images/sm_reptiles.gif" /></a> 
                      <img border="0" src="images/separator.gif" /> 
                      <a href="viewCategory.do?categoryId=CATS"><img border="0" 
src="images/sm_cats.gif" /></a> 
                      <img border="0" src="images/separator.gif" />
                      <a href="viewCategory.do?categoryId=BIRDS"><img border="0" 
src="images/sm_birds.gif" /></a> 
                  </center>
                  <br />
                  <xsl:apply-templates/>
                  <p align="center">
                      <a href="http://cocoon.apache.org";><img border="0" 
align="center" src="images/cocoon.gif" /></a>
                  </p>
              </body>
          </html>
      </xsl:template>
  
      <xsl:template match="welcome">
          <table border="0" cellspacing="0" width="100%">
              <tbody>
                  <tr>
                      <td valign="top" width="100%">
                          <table align="left" border="0" cellspacing="0" width="80%">
                              <tbody>
                                  <tr>
                                      <td valign="top">
                                      <!-- SIDEBAR -->
                                          <xsl:apply-templates/>
                                      </td>
                                      <td align="center" bgcolor="white" height="300" 
width="100%">
  
                                      <!-- MAIN IMAGE -->
  
                                          <map name="estoremap">
                                              <area alt="Birds" coords="72,2,280,250" 
href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
                                              <area alt="Fish" coords="2,180,72,250" 
href="viewCategory.do?categoryId=FISH" shape="RECT" />
                                              <area alt="Dogs" coords="60,250,130,320" 
href="viewCategory.do?categoryId=DOGS" shape="RECT" />
                                              <area alt="Reptiles" 
coords="140,270,210,340" href="viewCategory.do?categoryId=REPTILES" shape="RECT" />
                                              <area alt="Cats" 
coords="225,240,295,310" href="viewCategory.do?categoryId=CATS" shape="RECT" />
                                              <area alt="Birds" 
coords="280,180,350,250" href="viewCategory.do?categoryId=BIRDS" shape="RECT" />
                                          </map>
                                          <img border="0" height="355" 
src="images/splash.gif" align="center" usemap="#estoremap" width="350" />
                                      </td>
                                  </tr>
                              </tbody>
                          </table>
                      </td>
                  </tr>
              </tbody>
          </table>
      </xsl:template>
  
      <xsl:template match="menu">
          <table bgcolor="#FFFF88" border="0" cellspacing="0" cellpadding="5" 
width="200">
              <tbody>
                  <tr>
                      <td>
                          <!-- 
                          #if (!$accountForm.signOn)
                          <b><i><font size="2" color="BLACK">Welcome 
$accountForm.account.firstName!</font></i></b>
                          #end
                          -->
                      </td>
                  </tr>
                  <xsl:apply-templates/>
              </tbody>
          </table>
      </xsl:template>
  
      <xsl:template match="menu/category">
          <tr>
              <td>
                  <a href="[EMAIL PROTECTED]"><i><h2><xsl:value-of select="@name" 
/></h2></i></a>
              </td>
          </tr>
      </xsl:template>
  
      <xsl:template match="backpointer">
          <table align="left" bgcolor="#008800" border="0" cellspacing="2" 
cellpadding="2">
              <tr>
                  <td bgcolor="#FFFF88">
                      <a href="[EMAIL PROTECTED]"><b><font color="BLACK" 
size="2">&lt;&lt; <xsl:value-of select="@name" /></font></b></a>
                  </td>
              </tr>
          </table>
      </xsl:template>
  
      <xsl:template match="category">
          <p>
              <center>
                  <h2><xsl:value-of select="@name" /></h2>
              </center>
              <table align="center" bgcolor="#008800" border="0" cellspacing="2" 
cellpadding="3">
                  <tr bgcolor="#CCCCCC">
                      <td>
                          <b>Product ID</b>
                      </td>
                      <td>
                          <b>Name</b>
                      </td>
                  </tr>
                  <xsl:apply-templates/>
              </table>
          </p>
      </xsl:template>
  
      <xsl:template match="category/product">
          <tr bgcolor="#FFFF88">
              <td>
                  <b><a href="[EMAIL PROTECTED]"><font color="BLACK"><xsl:value-of 
select="@id" /></font></a></b>
              </td>
              <td>
                  <xsl:value-of select="@name" />
              </td>
          </tr>
      </xsl:template>
      
      <xsl:template match="search">
          <table align="center" bgcolor="#008800" border="0" cellspacing="2" 
cellpadding="3">
              <tr bgcolor="#CCCCCC">
                  <td></td>
                  <td>
                      <b>Product ID</b>
                  </td>
                  <td>
                      <b>Name</b>
                  </td>
              </tr>
              
              <xsl:apply-templates/>
          </table>
  
      </xsl:template>
  
      <xsl:template match="search/product">
          <tr bgcolor="#FFFF88">
              <td><a href="[EMAIL PROTECTED]"><xsl:value-of select="product-desc" 
/></a></td>
              <td>
                  <b><a href="[EMAIL PROTECTED]"><font color="BLACK"><xsl:value-of 
select="@id" /></font></a></b>
              </td>
              <td><xsl:value-of select="@name" /></td>
          </tr>
      </xsl:template>
  
      <xsl:template match="situation">
          <tr>
              <td>
                  <xsl:if test="@firstPage='false'" >
                      <a href="[EMAIL PROTECTED]"><font color="white"><B>&lt;&lt; 
Prev</B></font></a>
                  </xsl:if>
                  <xsl:if test="@lastPage='false'" >
                      <a href="[EMAIL PROTECTED]"><font color="white"><B>Next 
&gt;&gt;</B></font></a>
                  </xsl:if>
              </td>
          </tr>
      </xsl:template>
  
      <xsl:template match="product">
          <p>
              <center>
                  <b><font size="4"><xsl:value-of select="@name" /></font></b>
              </center>
              
              <table align="center" bgcolor="#008800" border="0" cellspacing="2" 
cellpadding="3">
                  <tr bgcolor="#CCCCCC">
                      <td><b>Item ID</b></td>
                      <td><b>Product ID</b></td>
                      <td><b>Description</b></td>
                      <td><b>List Price</b></td>
                      <td></td>
                  </tr>
                  <xsl:apply-templates/>
              </table>
          </p>
      </xsl:template>
  
      <xsl:template match="product/item">
          <tr bgcolor="#FFFF88">
              <td>
                  <b><a href="[EMAIL PROTECTED]"><xsl:value-of select="@id" /></a></b>
              </td>
              <td>
                  <b><xsl:value-of select="@product-id" /></b>
              </td>
              <td>
                  <xsl:value-of select="desc" /><xsl:text> </xsl:text><xsl:value-of 
select="../@name" />
              </td>
              <td>
                  <xsl:text>$</xsl:text> <xsl:value-of select="price" />
              </td>
              <td>
                  <a href="[EMAIL PROTECTED]"><img border="0" 
src="images/button_add_to_cart.gif" /></a>
              </td>
          </tr>
      </xsl:template>
  
  
      <xsl:template match="cart">
          <p>
              <center>
                  <b><font size="4"><xsl:value-of select="@name" /></font></b>
              </center>
              <form action="updateCartQuantities.do" method="post" >
                  <table align="center" bgcolor="#008800" border="0" cellspacing="2" 
cellpadding="5">
                      <tr bgcolor="#cccccc">
                          <td><b>Item ID</b></td>
                          <td><b>Product ID</b></td>
                          <td><b>Description</b></td>
                          <td><b>Quantity</b></td>
                          <td><b>List Price</b></td>
                          <td></td>
                      </tr>
                      <xsl:if test="not(item)">
                          <tr bgcolor="#FFFF88">
                              <td colspan="6">
                                  <b>Your cart is empty.</b>
                              </td>
                          </tr>
                      </xsl:if>
                      <xsl:apply-templates/>
                      <tr bgcolor="#FFFF88">
                          <td colspan="5" align="right">
                              <b>Sub Total: <xsl:value-of select="total" /></b><br />
                              <input type="image" border="0" 
src="images/button_update_cart.gif" name="update" />
                          </td>
                          <td></td>
                      </tr>
                  </table>
              </form>
          </p>
      </xsl:template>
  
      <xsl:template match="cart/item">
          <tr bgcolor="#FFFF88">
              <td>
                  <b><a 
href="viewItem.do?cartItem=$cartItem.item.itemId"><xsl:value-of select="@id" /></a></b>
              </td>
              <td>
                  <xsl:value-of select="@product-id" />
              </td>
               <td>
                      <xsl:value-of select="desc" />
               </td>
              <td align="center">
                  <input type="text" size="3" name="[EMAIL PROTECTED]" 
value="{quantity}" />
              </td>
              <td align="right">
                  <xsl:value-of select="price" />
              </td>
              <td><a href="[EMAIL PROTECTED]">
                  <img border="0" src="images/button_remove.gif" /></a>
              </td>
          </tr>
      </xsl:template>
      
      
  
  
      <xsl:template match="item">
          <p>
              <table align="center" bgcolor="#008800" cellspacing="2" cellpadding="3" 
border="0" width="60%">
                  <tr bgcolor="#FFFF88">
                      <td bgcolor="#FFFFFF">
                          <xsl:value-of select="product-desc" />
                      </td>
                  </tr>
                  <tr bgcolor="#FFFF88">
                      <td width="100%" bgcolor="#cccccc">
                        <b><xsl:value-of select="@id" /></b>
                      </td>
                  </tr>
                  <tr bgcolor="#FFFF88">
                      <td>
                          <b><font size="4"><xsl:value-of select="desc" /></font></b>
                      </td>
                  </tr>
                  <tr bgcolor="#FFFF88">
                      <td>
                          <font size="3"><i><xsl:value-of select="product-name" 
/></i></font>
                      </td>
                  </tr>
                      <!-- quantity stuff still missing -->
                  
                  <tr bgcolor="#FFFF88">
                      <td>
                          <xsl:text>$</xsl:text> <xsl:value-of select="price" />
                      </td>
                  </tr>
                  <tr bgcolor="#FFFF88">
                      <td>
                          <a href="[EMAIL PROTECTED]" ><img border="0" 
src="images/button_add_to_cart.gif" /></a>
                      </td>
                  </tr>
              </table>
          </p>
      </xsl:template>
  
      <xsl:template match="[EMAIL PROTECTED]'workingAccountForm']">
          <form>
              <xsl:copy-of select="@action | @method | @styleId "/>
              <xsl:choose>
                  <xsl:when test="/site/@signOn='true'">
                      <hidden name="workingAccountForm" property="validate" 
value="newAccount"/>
                  </xsl:when>
                  <xsl:otherwise>
                      <hidden name="workingAccountForm" property="validate" 
value="editAccount" />
                      <hidden name="workingAccountForm" property="account.username" />
                  </xsl:otherwise>
              </xsl:choose>
              <table cellpadding="10" cellspacing="0" align="center" border="1" 
bgcolor="#dddddd">
                  <tr>
                      <td>
                      <xsl:apply-templates/>
                      </td>
                  </tr>
              </table>
              <br />
              <center>
                  <input border="0" type="image" src="images/button_submit.gif" 
name="submit" value="Save Account Information" />
              </center>
          </form>
          <xsl:if test="/site/@signOn='true'">
              <p>
                  <center><b><a href="listOrders.do">My Orders</a></b></center>
              </p>
          </xsl:if>
      </xsl:template>
  
      <xsl:template match="panel">
          <font color="darkgreen"><h3><xsl:value-of select="@label" /></h3></font>
          <table border="0" cellpadding="3" cellspacing="1" bgcolor="#008800">
              <xsl:apply-templates/>
          </table>
      </xsl:template>
      
      <xsl:template match="[EMAIL PROTECTED]'signon']">
          <form>
              <xsl:copy-of select="@action | @method"/>
              <table align="center" border="0">
                  <tr>
                      <td colspan="2">Please enter your username and password.<br /> 
</td>
                  </tr>
                  <xsl:apply-templates/>
              </table>
          </form>
      </xsl:template>
      
      <xsl:template match="panel/select">
          <tr bgcolor="#FFFF88">
              <td><xsl:value-of select="@label" /></td>
              <td>
                  <select>
                      <xsl:copy-of select="@type | @src | @value | @name | @size | 
@selected | node()" />
                  </select>
              </td>
          </tr>
      </xsl:template>
      
      <xsl:template match="panel/input">
          <tr bgcolor="#FFFF88">
              <td><xsl:value-of select="@label" /></td>
              <td><input><xsl:copy-of select="@type | @src | @value | @name | @size | 
@selected"/></input></td>
          </tr>
      </xsl:template>
      
      <xsl:template match="input">
          <tr>
              <td><xsl:value-of select="@label" /></td>
              <td><input><xsl:copy-of select="@type | @src | @value | @name | @size | 
@selected"/></input></td>
          </tr>
      </xsl:template>
      
      <xsl:template match="message">
          <b><font color="RED"><xsl:value-of select="." /></font></b>
      </xsl:template>
  
      <xsl:template match="register">
          <center>
              <a href="newAccountForm.do"><img border="0" 
src="images/button_register_now.gif" /></a>
          </center>
      </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/Cart.xsp
  
  Index: Cart.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <backpointer name="Main Menu" do="index.do" />
          <cart name="Shopping Cart" >
          <!-- this doesn't work !!! how do I have to access the required field via 
jpath?? -->
              <jpath:for-each select="cartItems" >
                  <item>
                      <xsp:attribute name="product-id"><jpath:value-of 
select="item/productId"/></xsp:attribute>
                      <xsp:attribute name="id"><jpath:value-of 
select="item/itemId"/></xsp:attribute>
                      <desc>
                          <jpath:value-of select="item/attr1"/> 
                          <jpath:value-of select="item/attr2"/> 
                          <jpath:value-of select="item/attr3"/> 
                          <jpath:value-of select="item/attr4"/> 
                          <jpath:value-of select="item/attr5"/> 
                          <jpath:value-of select="item/product/name"/> 
                      </desc>
                      <price><jpath:value-of select="item/listPrice"/></price>
                      <quantity><jpath:value-of select="quantity"/></quantity>
                  </item>
              </jpath:for-each>
              <total><jpath:value-of select="cartForm/cart/subTotal"/></total>
          </cart>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/Category.xsp
  
  Index: Category.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <backpointer name="Main Menu" do="index.do" />
          <category>
              <xsp:attribute name="name"><jpath:value-of 
select="category/name"/></xsp:attribute>
              <jpath:for-each select="productList" >
                  <product>
                      <xsp:attribute name="name"><jpath:value-of 
select="name"/></xsp:attribute>
                      <xsp:attribute name="id"><jpath:value-of 
select="productId"/></xsp:attribute>
                  </product>
              </jpath:for-each>
              <situation>
                  <xsp:attribute name="firstPage"><jpath:value-of 
select="firstPage"/></xsp:attribute>
                  <xsp:attribute name="lastPage"><jpath:value-of 
select="lastPage"/></xsp:attribute>
                  <xsp:attribute 
name="continuation"><jpath:continuation/></xsp:attribute>
              </situation>
          </category>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/EditAccountForm.xsp
  
  Index: EditAccountForm.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <form method="POST" styleId="workingAccountForm">
              <xsp:attribute name="action"><jpath:continuation/>.kont</xsp:attribute>
  <!--
          <input type="hidden" name="validate" value="editAccount" />
          <input type="hidden"  name="account.username" /> -->
  <!-- ...hmm? -->
              <panel label="User Information">
                  <input name="workingAccountForm.account.username" label="User ID" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/username" /></xsp:attribute>
                  </input>
                  <input type="password" name="workingAccountForm.account.password" 
label="New password" />
                  <input type="password" name="workingAccountForm.repeatedPassword" 
label="Repeat password" />
              </panel>
              
              <panel label="Account Information">
                  <input type="text" label="First name">
                      <xsp:attribute name="value"><jpath:value-of 
select="account/firstName"/></xsp:attribute>
                  </input>
                  <input type="text" label="Last name" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/firstName"/></xsp:attribute>
                  </input>
                  <input type="text" size="40" name="workingAccountForm.email" 
label="Email" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/lastName"/></xsp:attribute>
                  </input>
                  <input type="text" name="workingAccountForm.phone" label="Phone" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/phone"/></xsp:attribute>
                  </input>
                  <input type="text" size="40" name="workingAccountForm.address1" 
label="Address 1" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/address1"/></xsp:attribute>
                  </input>
                  <input type="text" size="40" name="workingAccountForm.address2" 
label="Address 2" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/address2"/></xsp:attribute>
                  </input>
                  <input type="text" name="workingAccountForm.city" label="City" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/city"/></xsp:attribute>
                  </input>
                  <input type="text" name="workingAccountForm.state" label="State" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/state"/></xsp:attribute>
                  </input>
                  <input type="text" name="workingAccountForm.zip" label="Zip" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/zip"/></xsp:attribute>
                  </input>
                  <input type="text" size="15" name="workingAccountForm.country" 
label="Country" >
                      <xsp:attribute name="value"><jpath:value-of 
select="account/country"/></xsp:attribute>
                  </input>
              </panel>
              
              <panel label="Profile Information">
                  <select name="workingAccountForm.languagePreference" label="Language 
Preference">
                      <option value="English">English</option>
                      <option value="Japanese">Japanese</option>
                  </select>
                  <select name="workingAccountForm.account.favouriteCategoryId" 
label="Favourite Category">
                      <jpath:for-each select="categoryList" >
                          <option><xsp:attribute name="value"><jpath:value-of 
select="name" /></xsp:attribute><jpath:value-of select="name" /></option>
                      </jpath:for-each>
                  </select>
                  <input type="checkbox" name="workingAccountForm.account.listOption" 
label="Enable MyList"/> 
                  <input type="checkbox" 
name="workingAccountForm.account.bannerOption" label="Enable MyBanner"/>
              </panel>
              
          </form>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/Item.xsp
  
  Index: Item.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <backpointer>
              <xsp:attribute name="name"><jpath:value-of 
select="product/name"/></xsp:attribute>
              <xsp:attribute name="do">viewProduct.do?productId=<jpath:value-of 
select="product/productId"/></xsp:attribute>
          </backpointer>
          <item>
              <xsp:attribute name="id"><jpath:value-of 
select="item/itemId"/></xsp:attribute>
              <product-desc><jpath:value-of select="product/descn"/></product-desc>
              <product-name><jpath:value-of select="product/name"/></product-name>
              <desc>
                  <jpath:value-of select="item/attr1"/> 
                  <jpath:value-of select="item/attr2"/> 
                  <jpath:value-of select="item/attr3"/> 
                  <jpath:value-of select="item/attr4"/> 
                  <jpath:value-of select="item/attr5"/> 
                  <jpath:value-of select="item/product/name"/> 
              </desc>
              <price><jpath:value-of select="item/listPrice"/></price>
  <!--                    <item-quantity><jpath:value-of 
select="item/quantity"/></item-quantity>-->
          </item>
  
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/Product.xsp
  
  Index: Product.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
  
  
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <backpointer>
              <xsp:attribute name="name"><jpath:value-of 
select="product/category"/></xsp:attribute>
              <xsp:attribute name="do">viewCategory.do?categoryId=<jpath:value-of 
select="product/category"/></xsp:attribute>
          </backpointer>
          <product>
              <xsp:attribute name="name"><jpath:value-of 
select="product/name"/></xsp:attribute>
              <jpath:for-each select="itemList" >
                  <item>
                      <xsp:attribute name="product-id"><jpath:value-of 
select="productId"/></xsp:attribute>
                      <xsp:attribute name="id"><jpath:value-of 
select="itemId"/></xsp:attribute>
                      <desc>
                          <jpath:value-of select="attr1"/> 
                          <jpath:value-of select="attr2"/> 
                          <jpath:value-of select="attr3"/> 
                          <jpath:value-of select="attr4"/> 
                          <jpath:value-of select="attr5"/> 
                      </desc>
                      <price><jpath:value-of select="listPrice"/></price>
                  </item>
              </jpath:for-each>
              <situation>
                  <xsp:attribute name="firstPage"><jpath:value-of 
select="firstPage"/></xsp:attribute>
                  <xsp:attribute name="lastPage"><jpath:value-of 
select="lastPage"/></xsp:attribute>
                  <xsp:attribute 
name="continuation"><jpath:continuation/></xsp:attribute>
              </situation>
          </product>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/SearchProducts.xsp
  
  Index: SearchProducts.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><!--<jpath:value-of 
select="accountForm/signOn"/>-->true</xsp:attribute>
          <backpointer name="Main Menu" do="index.do" />
          <search>
              <jpath:for-each select="searchResultsProductList" >
                  <product>
                      <xsp:attribute name="name"><jpath:value-of 
select="name"/></xsp:attribute>
                      <xsp:attribute name="id"><jpath:value-of 
select="productId"/></xsp:attribute>
                      <product-desc><jpath:value-of select="descn"/></product-desc>
                  </product>
              </jpath:for-each>
              <situation>
                  <xsp:attribute name="firstPage"><jpath:value-of 
select="firstPage"/></xsp:attribute>
                  <xsp:attribute name="lastPage"><jpath:value-of 
select="lastPage"/></xsp:attribute>
                  <xsp:attribute 
name="continuation"><jpath:continuation/></xsp:attribute>
              </situation>
          </search>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/SignonForm.xsp
  
  Index: SignonForm.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
          <form method="POST" label="signon">
              <xsp:attribute name="action"><jpath:continuation/>.kont</xsp:attribute>
              <message><jpath:value-of select="//message"/></message>
              <input type="text" name="username" value="j2ee" label="Username" />
              <input type="password" name="password" value="j2ee" label="Password" />
              <input type="image" src="images/button_submit.gif" name="update" />
          </form>
          <register/>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  
  1.1                  
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/xsp/index.xsp
  
  Index: index.xsp
  ===================================================================
  <?xml version="1.0"?>
  
  <xsp:page
    language="java"
    xmlns:xsp="http://apache.org/xsp";
    xmlns:jpath="http://apache.org/xsp/jpath/1.0";
    >
  
      <site>
          <xsp:attribute name="signOn"><jpath:value-of 
select="accountForm/signOn"/></xsp:attribute>
              <welcome>
  <!-- doesn't work
                  <jpath:if test="accountForm/signOn = 'false'">
                      <firstName><jpath:value-of 
select="accountForm/account/firstName"/></firstName>
                  </jpath:if>
  -->         
                  <menu>
                      <jpath:for-each select="categoryList" >
                          <category>
                              <xsp:attribute name="name"><jpath:value-of 
select="name"/></xsp:attribute>
                              <xsp:attribute name="id"><jpath:value-of 
select="catId"/></xsp:attribute>
                          </category>
                      </jpath:for-each>
                  </menu>
              </welcome>
      </site>
  
  </xsp:page>
  
  
  
  
  
  
  

Reply via email to