home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / newWizard2html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  11.5 KB  |  296 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!--
  18.     Cocoon WebServiceProxyGenerator 
  19.     Feedback Wizard processing and displaying stylesheet.    
  20.   
  21.   This stylesheet merges an XMLForm document into 
  22.   a pre-final HTML document. It includes other presentational
  23.   parts of a page orthogonal to the xmlform.
  24.  
  25.   author: Ivelin Ivanov, ivelin@apache.org, June 2002
  26.  
  27. -->
  28.  
  29. <xsl:stylesheet 
  30.     version="1.0" 
  31.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  32.     xmlns:xf="http://apache.org/cocoon/xmlform/1.0"
  33.     exclude-result-prefixes="xalan"
  34. >
  35.  
  36.     <xsl:template match="document">
  37.         <html>
  38.             <head>
  39.                 <title>Embedding One Web Site into another with Cocoon WebServiceProxyGenerator Demo </title>        
  40.                 <style type="text/css">
  41.                 <![CDATA[
  42.               H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #009900;} 
  43.               BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : #AAFFAA;} 
  44.               B{color : white;background-color : #5090a0;} 
  45.               HR{color : #0086b2;}
  46.               input { background-color: #FFFFFF; color: #000099; border: 1px solid #0000FF; }        
  47.               table { background-color: #DDDDFF; color: #000099; font-size: x-small; border: 2px solid brown;}
  48.               select { background-color: #FFFFFF; color: #000099 }
  49.              .error { color: #FF0000; }          
  50.              .invalid { color: #FF0000; border: 2px solid #FF0000; }
  51.              .info { color: #0000FF; border: 1px solid #0000FF; }
  52.              .repeat { background-color: #AAAACC; border: 0px inset #999999;border: 1px inset #999999; width: 100%; }
  53.              .group { background-color: #AAAACC; border: 0px inset #999999;border: 0px inset #999999;  width: 100%; }
  54.              .sub-table { background-color: #AAAACC; border: 1px inset black; }
  55.              .button { background-color: green; color: white; border: 5px solid #AAFFAA; width: 90px; }
  56.              .plaintable { background-color: #AAAACC; border: 1px inset black;border: 1px inset black; width: 100%; }
  57.               ]]>
  58.                 </style>            
  59.               </head>
  60.             <body>
  61.                 <table border="3">
  62.                   <tr>
  63.                     <td colspan="2" align="center">
  64.                         <br/>
  65.                         Embedding One Web Site into Another 
  66.                         <br/><br/>
  67.                         made easy with Cocoon 
  68.                         <br/><br/>
  69.                     </td>
  70.                   </tr>
  71.                   <tr>
  72.                     <td width="20%" valign="top">
  73.                       Navigation bar of the containing web site
  74.                         <ul>
  75.                           <li>
  76.                               Remote Web Site
  77.                           </li>
  78.                           <li>
  79.                               Local Content
  80.                           </li>
  81.                           <li>
  82.                               All look like ONE.
  83.                           </li>
  84.                         </ul>
  85.                     </td>
  86.                     <td>
  87.                       This is area for an embedded web site.
  88.                       <br/>
  89.                       <xsl:apply-templates />
  90.                     </td>
  91.                   </tr>
  92.                   <tr>
  93.                     <td colspan="2">
  94.                       <p>
  95.                       Remote Web Site Integration is an easy task with Cocoon.
  96.                       This demo shows how the WebServiceProxyGenerator sitemap component, 
  97.                       combined with the XMLForm framework and XSLT, allows 
  98.                       vendors to share interactive content with little effort.
  99.                       </p>
  100.                       <p>
  101.                       The Web Service Proxy takes advantage of the fact that 
  102.                       a Cocoon web application produces XML content
  103.                       which is later translated into multiple presentation formats, like HTML or WML.
  104.                       </p>
  105.                       <p>
  106.                       This demo embeds the Cocoon Feedback Wizard application, which produces an XML
  107.                       view containing both static data and interactive forms.
  108.                       Having a client independent content format, allows this view to be 
  109.                       pulled to the embedding web site (this demo) and styled with XSLT 
  110.                       in the Look & Feel of the site.
  111.                       </p>
  112.                       <p>
  113.                       <i>
  114.                       Ok, styling presentation is easy to understand, but how is a form submitted to the original site?
  115.                       </i>
  116.                       <br/>
  117.                       Since the form markup in the XML content of an embedded page uses relative URL
  118.                       address for the target, once the end user submits, the form data is sent to the 
  119.                       containing site, which captures the form data and the relative URL.
  120.                       The Web Service Proxy then takes this information and re-submits it to the
  121.                       original site. It then reads the XML response and makes it available to the 
  122.                       sitemap for styling again. 
  123.                       </p>
  124.                       <p>
  125.                       <i>
  126.                       Hm, but the Feedback Wizard example maintains a session while going through
  127.                       multiple pages. So, how is the containing site propagating the end user session to the 
  128.                       to the embedded site?
  129.                       </i>
  130.                       <br/>
  131.                       The answer is simple. The Web Service Proxy simply hooks to the end user session,
  132.                       and automatically starts its own session with the remote site.
  133.                       If the remote site does not require authentication, then everything is transparent
  134.                       to the developer of the containing web site. Otherwise the WebServiceProxyGenerator 
  135.                       has to be extended to override the procedure for initating session with the remote site.
  136.                       </p>
  137.                       <p>
  138.                       <i>What transport protocols are supported?</i>
  139.                       <br/>
  140.                       HTTP 1.0, HTTP 1.1, HTTPS.
  141.                       </p>
  142.                       <p>
  143.                       Have more questions? Look at the code, it is really simple.
  144.                       If you need advise, search through the Cocoon mailing lists archives.
  145.                       If you can't find the answer, email your question to the Cocoon mailing lists.
  146.                       Finally, if you need to contact me, send email to Ivelin Ivanov, ivelin@apache.org.
  147.                       </p>
  148.                       <p>
  149.                       If you like this component, please help with documentation.
  150.                       Write an FAQ, HOW-TO or User Guide.
  151.                       </p>
  152.                       <p>
  153.                       </p>
  154.                     </td>
  155.                   </tr>
  156.                 </table> 
  157.             </body>
  158.         </html>
  159.     </xsl:template>
  160.     
  161.     <xsl:template match="xf:form">
  162.     <xf:form method="post">
  163.       <xsl:copy-of select="@*" />
  164.         <br/><br/>
  165.         <i><u>... and This is a Personalized HTML Form:</u></i>
  166.         <br/><br/>
  167.         <table align="center" border="0" class="sub-table">
  168.           <tr>
  169.             <td align="center" colspan="3">
  170.                 <h1>
  171.                     <xsl:value-of select="xf:caption"/>
  172.                     <hr/>
  173.                 </h1>
  174.             </td>
  175.           </tr>
  176.           <xsl:if test="count(error/xf:violation) > 0">
  177.               <tr>
  178.                 <td align="left" colspan="3" class="{error/xf:violation[1]/@class}">
  179.                     <p>
  180.                     * There are
  181.                     [<b><xsl:value-of select="count(error/xf:violation)"/></b>]
  182.                     errors. Please fix these errors and submit the form again.
  183.                     </p>
  184.                     <p>
  185.                       <xsl:variable name="localViolations" select=".//xf:*[ child::xf:violation ]"/>
  186.                       <xsl:for-each 
  187.                         select="error/xf:violation">
  188.                         <xsl:variable name="eref" select="./@ref"/>
  189.                         <xsl:if test="count ($localViolations[ @ref=$eref ]) = 0">
  190.                             * 
  191.                             <xsl:value-of select="." />
  192.                             <br/>
  193.                         </xsl:if>
  194.                       </xsl:for-each>
  195.                     </p>
  196.                     <p/>
  197.                 </td>
  198.               </tr>
  199.           </xsl:if>
  200.  
  201.          <xsl:for-each select="*[name() != 'xf:submit']">
  202.           <xsl:choose>
  203.             <xsl:when test="name() = 'error'"/>
  204.             <xsl:when test="xf:*">
  205.                 <xsl:apply-templates select="."/>
  206.             </xsl:when>
  207.             <xsl:otherwise>
  208.                 <xsl:copy-of select="."/>
  209.             </xsl:otherwise>
  210.            </xsl:choose>
  211.          </xsl:for-each>
  212.         <tr>
  213.           <td align="center" colspan="3">
  214.             <xsl:for-each select="*[name() = 'xf:submit']">
  215.               <xsl:copy-of select="." />
  216.               <xsl:text> </xsl:text>
  217.             </xsl:for-each>
  218.           </td>
  219.         </tr>
  220.       </table>
  221.     </xf:form>
  222.     </xsl:template>
  223.     
  224.     <xsl:template match="xf:repeat">
  225.         <tr  width="100%">
  226.             <td colspan="3" width="100%">
  227.               Repeat elements:
  228.                 <table class="repeat">
  229.                        <xsl:apply-templates select="*"/>
  230.                 </table>
  231.             </td>
  232.         </tr>
  233.       </xsl:template>
  234.  
  235.     <xsl:template match="xf:group">
  236.         <tr width="100%">
  237.             <td width="100%" colspan="2">
  238.                 Group element:
  239.                 <table class="group" border="0">
  240.                        <xsl:apply-templates select="*"/>
  241.                 </table>
  242.             </td>
  243.         </tr>
  244.       </xsl:template>
  245.     
  246.     <xsl:template match="xf:output[@form]">
  247.         <div align="center"> 
  248.             <hr width="30%"/>
  249.             <br/>
  250.             <font size="-1">
  251.               <code>
  252.               [*]
  253.                 <xsl:value-of select="xf:caption" /> :
  254.                 <xsl:copy-of select="." />
  255.               </code>
  256.             </font>
  257.             <br/>
  258.         </div>
  259.     </xsl:template>
  260.     
  261.  
  262.     <xsl:template match="xf:*">
  263.       <tr>
  264.           <td align="left">
  265.             <xsl:value-of select="xf:caption" />
  266.           </td>
  267.           <td align="left">
  268.         <table class="plaintable">
  269.          <tr>
  270.           <td align="left">
  271.             <xsl:copy-of select="." />
  272.           </td>
  273.           <xsl:if test="xf:violation">
  274.               <td align="left" class="{xf:violation[1]/@class}" width="100%">
  275.                 <xsl:for-each select="xf:violation">
  276.                   * <xsl:value-of select="." />
  277.                   <br/>
  278.                 </xsl:for-each>
  279.               </td>
  280.           </xsl:if>
  281.          </tr>
  282.         </table>
  283.           </td>
  284.       </tr>
  285.     </xsl:template>
  286.     
  287.         
  288.     <xsl:template match="*">
  289.         <xsl:copy-of select="." />
  290.     </xsl:template>
  291.     
  292. </xsl:stylesheet>
  293.  
  294.  
  295.  
  296.