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 / TO-html.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  7.3 KB  |  234 lines

  1. <?xml version="1.0"?>
  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. <!-- $Id: TO-html.xsl,v 1.3 2004/03/06 02:25:39 antonio Exp $ 
  19.  
  20. -->
  21.  
  22. <xsl:stylesheet version="1.0" 
  23.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  24.  
  25. <xsl:template match="page">
  26.    <html>
  27.     <head>
  28.      <title>
  29.       <xsl:if test="@title"><xsl:value-of select="@title"/></xsl:if>
  30.       <xsl:if test="not(@title)">Cocoon Portal</xsl:if>
  31.      </title>
  32.      <xsl:if test="@logout">
  33.        <script language="JavaScript"> 
  34.         function timeout() {
  35.             window.setTimeout("test()", 1500); 
  36.         }
  37.         function test() {  
  38.               top.location.href = "sunspotdemofree-portal";
  39.         } 
  40.      </script> 
  41.      </xsl:if>
  42.     </head>
  43.      <xsl:apply-templates/>
  44.    </html>
  45.   </xsl:template>
  46.  
  47. <xsl:template match="content">
  48.     <body text="#0B2A51" link="#0B2A51" vlink="#666666">
  49.         <xsl:apply-templates select="@*"/>
  50.       <xsl:if test="/page/@logout">
  51.         <xsl:attribute name="onLoad">timeout()</xsl:attribute>
  52.       </xsl:if>
  53.       <xsl:if test="/page/@bgcolor">
  54.         <xsl:attribute name="bgcolor"><xsl:value-of select="/page/@bgcolor"/></xsl:attribute>
  55.       </xsl:if>
  56.       <xsl:if test="/page/@textcolor">
  57.         <xsl:attribute name="text"><xsl:value-of select="/page/@textcolor"/></xsl:attribute>
  58.       </xsl:if>
  59.       <xsl:if test="/page/@background">
  60.         <xsl:attribute name="background"><xsl:value-of select="/page/@background"/></xsl:attribute>
  61.       </xsl:if>
  62.       <xsl:apply-templates/>                                        
  63.     </body>
  64. </xsl:template>
  65.  
  66. <xsl:template match="logoutcontent">
  67.     <body text="#0B2A51" link="#0B2A51" vlink="#666666">
  68.         <xsl:apply-templates select="@*"/>
  69.       <xsl:if test="/page/@logout">
  70.         <xsl:attribute name="onLoad">timeout()</xsl:attribute>
  71.       </xsl:if>
  72.       <xsl:if test="/page/@bgcolor">
  73.         <xsl:attribute name="bgcolor"><xsl:value-of select="/page/@bgcolor"/></xsl:attribute>
  74.       </xsl:if>
  75.       <xsl:if test="/page/@textcolor">
  76.         <xsl:attribute name="text"><xsl:value-of select="/page/@textcolor"/></xsl:attribute>
  77.       </xsl:if>
  78.       <xsl:if test="/page/@background">
  79.         <xsl:attribute name="background"><xsl:value-of select="/page/@background"/></xsl:attribute>
  80.       </xsl:if>
  81.     <table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
  82.             <tr>
  83.                 <td height="100%" noWrap="" width="193" valign="top" bgcolor="#46627a">
  84.                     <img height="2" src="sunspotdemoimg-space.gif" width="1"/>
  85.                 </td>
  86.                 <td>
  87.                     <table border="0" width="100%" cellspacing="0" cellpadding="0">
  88.                         <xsl:attribute name="bgcolor">
  89.                             <xsl:value-of select="portalconf/layout-profile/portal/layouts/layout/background/color"/>
  90.                         </xsl:attribute>
  91.                             
  92.                             <tr>
  93.                                 <td width="1%"><img src="sunspotdemoimg-space.gif" width="20" height="1"/></td>
  94.                                 <td align="center">
  95.                                     <img src="sunspotdemoimg-space.gif" height="20" width="1"/>
  96.                                     <table border="0" width="100%">
  97.                                         <tr>
  98.                                             <td>    
  99.       <xsl:apply-templates/>    
  100.     </td>
  101.                                         </tr>
  102.                                     </table>
  103.                                 </td>
  104.                                 <td><img src="sunspotdemoimg-space.gif" width="20"/></td>
  105.                             </tr>
  106.                         </table>
  107.                     </td>
  108.                 </tr>
  109.         </table>                                    
  110.     </body>
  111. </xsl:template>
  112.  
  113.   <xsl:template match="paragraph">
  114.     <xsl:if test="@title">
  115.       <font face="Arial, Helvetica, sans-serif" size="3">
  116.           <b>
  117.         <xsl:value-of select="@title"/>
  118.         </b>
  119.       </font>
  120.     </xsl:if>                                
  121.     <p>
  122.        <font face="Arial, Helvetica, sans-serif" size="2">
  123.              <xsl:apply-templates/>    
  124.      </font>
  125.    </p>
  126.   </xsl:template>
  127.  
  128.   <xsl:template match="logoutparagraph">                            
  129.     <p>
  130.        <font face="Arial, Helvetica, sans-serif" size="2">
  131.              <xsl:apply-templates/>    
  132.      </font>
  133.    </p>
  134.   </xsl:template>
  135.  
  136.   <xsl:template match="pageset">
  137.       <frameset border="0" frameborder="0" framespacing="0" noresize="">
  138.         <xsl:if test="@rows">
  139.           <xsl:attribute name="rows"><xsl:value-of select="@rows"/></xsl:attribute>
  140.         </xsl:if>
  141.         <xsl:if test="@columns">
  142.           <xsl:attribute name="cols"><xsl:value-of select="@columns"/></xsl:attribute>
  143.         </xsl:if>
  144.         <xsl:apply-templates/>
  145.       </frameset>
  146.   </xsl:template>
  147.  
  148.   <xsl:template match="pagepart">
  149.     <xsl:apply-templates/>
  150.   </xsl:template>
  151.  
  152.   <xsl:template match="part">  
  153.     <frame frameborder="0" border="0" noresize="" marginHeight="0" marginwidth="0">
  154.       <xsl:attribute name="src"><xsl:value-of select="normalize-space(url)"/></xsl:attribute>
  155.       <xsl:attribute name="name"><xsl:value-of select="@title"/></xsl:attribute>
  156.       <xsl:if test="@scrolling">
  157.         <xsl:attribute name="scrolling"><xsl:value-of select="@scrolling"/></xsl:attribute>
  158.       </xsl:if>
  159.       <xsl:if test="@noresize">
  160.         <xsl:attribute name="noresize"><xsl:value-of select="@noresize"/></xsl:attribute>
  161.       </xsl:if>
  162.     </frame>  
  163.   </xsl:template>
  164.  
  165.   <xsl:template match="picture">
  166.     <xsl:if test="action">
  167.       <a href="{action/@url}">
  168.         <img border="0">
  169.           <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute>
  170.         </img>
  171.       </a>
  172.     </xsl:if>
  173.     <xsl:if test="not(action)">    
  174.       <img>
  175.         <xsl:attribute name="src"><xsl:value-of select="@url"/></xsl:attribute>
  176.       </img>
  177.      </xsl:if>
  178.   </xsl:template>
  179.  
  180.   <xsl:template match="picturedyn">
  181.     <xsl:if test="action">
  182.       <a href="{action/@url}">
  183.         <img border="0">
  184.           <xsl:attribute name="src"><xsl:value-of select="normalize-space(url)"/></xsl:attribute>
  185.         </img>
  186.       </a>
  187.     </xsl:if>
  188.     <xsl:if test="not(action)">    
  189.       <img border="0">
  190.         <xsl:attribute name="src"><xsl:value-of select="normalize-space(url)"/></xsl:attribute>
  191.       </img>
  192.      </xsl:if>
  193.   </xsl:template>
  194.  
  195.   <xsl:template match="link">
  196.     <a>
  197.       <xsl:choose>
  198.         <xsl:when test="starts-with(normalize-space(url), 'http')">
  199.           <xsl:attribute name="target">_new</xsl:attribute>
  200.         </xsl:when>
  201.         <xsl:when test="target">
  202.             <xsl:attribute name="target"><xsl:value-of select="normalize-space(target)"/></xsl:attribute>
  203.         </xsl:when>     
  204.         <xsl:otherwise>
  205.           <xsl:attribute name="target">Main</xsl:attribute>
  206.         </xsl:otherwise>
  207.       </xsl:choose>
  208.     
  209.       <xsl:attribute name="href"><xsl:value-of select="normalize-space(url)"/></xsl:attribute>
  210.       <xsl:value-of select="normalize-space(text)"/>
  211.     </a>
  212.   </xsl:template>
  213.  
  214.   <xsl:template match="field">
  215.     <td>
  216.     <xsl:value-of select="@name"/>
  217.     </td>
  218.     <td>
  219.         <input type="text" size="30">
  220.             <xsl:attribute name="name"><xsl:value-of select="@field"/></xsl:attribute>
  221.             <xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
  222.         </input>
  223.     </td>
  224.   </xsl:template>
  225.  
  226.   <!-- Copy all and apply templates -->
  227.   <xsl:template match="@*|node()">
  228.    <xsl:copy>
  229.     <xsl:apply-templates select="@*|node()" />
  230.    </xsl:copy>
  231.   </xsl:template>
  232.  
  233. </xsl:stylesheet>
  234.