home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / openoffice / openofficeorg2.cab / layoutX.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-11-27  |  8.5 KB  |  329 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. #/*************************************************************************
  4. #
  5. #   $RCSfile: layoutX.xsl,v $
  6. #
  7. #   $Revision: 1.2 $
  8. #
  9. #   last change: $Author: kz $ $Date: 2004/05/19 15:03:19 $
  10. #
  11. #   The Contents of this file are made available subject to the terms of
  12. #   either of the following licenses
  13. #
  14. #          - GNU Lesser General Public License Version 2.1
  15. #          - Sun Industry Standards Source License Version 1.1
  16. #
  17. #   Sun Microsystems Inc., October, 2000
  18. #
  19. #   GNU Lesser General Public License Version 2.1
  20. #   =============================================
  21. #   Copyright 2000 by Sun Microsystems, Inc.
  22. #   901 San Antonio Road, Palo Alto, CA 94303, USA
  23. #
  24. #   This library is free software; you can redistribute it and/or
  25. #   modify it under the terms of the GNU Lesser General Public
  26. #   License version 2.1, as published by the Free Software Foundation.
  27. #
  28. #   This library is distributed in the hope that it will be useful,
  29. #   but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  31. #   Lesser General Public License for more details.
  32. #
  33. #   You should have received a copy of the GNU Lesser General Public
  34. #   License along with this library; if not, write to the Free Software
  35. #   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  36. #   MA  02111-1307  USA
  37. #
  38. #
  39. #   Sun Industry Standards Source License Version 1.1
  40. #   =================================================
  41. #   The contents of this file are subject to the Sun Industry Standards
  42. #   Source License Version 1.1 (the "License"); You may not use this file
  43. #   except in compliance with the License. You may obtain a copy of the
  44. #   License at http://www.openoffice.org/license.html.
  45. #
  46. #   Software provided under this License is provided on an "AS IS" basis,
  47. #   WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  48. #   WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  49. #   MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  50. #   See the License for the specific provisions governing your rights and
  51. #   obligations concerning the Software.
  52. #
  53. #   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  54. #
  55. #   Copyright: 2000 by Sun Microsystems, Inc.
  56. #
  57. #   All Rights Reserved.
  58. #
  59. #   Contributor(s): _______________________________________
  60. #
  61. #
  62. #
  63. #*************************************************************************
  64. -->
  65.  
  66. <xsl:stylesheet version="1.0" 
  67.    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  68.     xmlns="http://www.w3.org/1999/xhtml">
  69.     
  70.     <xsl:output method               = "html"
  71.                 media-type           = "text/html"
  72.                 indent               = "yes"
  73.                 doctype-public       = "-//W3C//DTD HTML 4.0 Transitional//EN"
  74.                 omit-xml-declaration = "yes"
  75.                 standalone           = "yes" />
  76.     
  77.     <xsl:include href="../layout.xsl"/>
  78.    
  79.  
  80.      <!-- =============================
  81.                    ROOT
  82.      ================================== -->
  83.  
  84.  
  85.     <xsl:template  match="/">
  86.           <html>
  87.                    <xsl:call-template name="head"/>
  88.                   <xsl:call-template name="body"/>
  89.            </html>
  90.      </xsl:template>
  91.      
  92.      
  93.      <!-- =============================
  94.                    HTML BODY
  95.      ================================== -->
  96.      
  97.      <xsl:template name="body">
  98.          <body>
  99.              <xsl:call-template name="title"/>
  100.              <xsl:call-template name="toc"/>
  101.         </body>
  102.      </xsl:template>
  103.      
  104.      
  105.      <xsl:template name="toc">
  106.         <!--
  107.              @ pre toc html here
  108.         -->
  109.         
  110.         <!-- use this to group documents, it
  111.         is for example usefull when generating tables -->
  112.         
  113.         <xsl:variable name="group" select="3"/>
  114.         
  115.         <xsl:for-each select="/session/content/document[ ( ( position() - 1 ) mod $group ) = 0 ]">
  116.             
  117.             <!-- 
  118.                 @ pre group html here 
  119.             -->
  120.             
  121.             <xsl:call-template name="document-group">
  122.               <xsl:with-param name="group" select="$group"/>
  123.             </xsl:call-template>  
  124.             
  125.             <!--
  126.                 @ post group html here
  127.             -->
  128.             
  129.         </xsl:for-each>
  130.  
  131.  
  132.         <!-- use this alternative if you do not need to use groups 
  133.         (uncomment to use - and do not forget to comment the group 
  134.         option above...)-->
  135.  
  136.         <!-- 
  137.       <xsl:apply-templates select="/session/content/document"/>
  138.         -->
  139.  
  140.         <!--
  141.              @ post toc html here
  142.         -->
  143.  
  144.      </xsl:template>
  145.      
  146.     <!-- also when using groups, in the end it comes 
  147.     to this template, which is called for each document -->
  148.     <xsl:template match="document">
  149.       <xsl:apply-templates select="@title"/>
  150.       <xsl:apply-templates select="@description"/>
  151.       <xsl:apply-templates select="@author"/>
  152.       <xsl:apply-templates select="@create-date"/>
  153.       <xsl:apply-templates select="@update-date"/>
  154.       <xsl:apply-templates select="@filename"/>
  155.       <xsl:apply-templates select="@format"/>
  156.       <xsl:apply-templates select="@format-icon"/>
  157.       <xsl:apply-templates select="@format-icon"/>
  158.     </xsl:template>
  159.         
  160.  
  161.      
  162.      <xsl:template name="document-group">
  163.          <xsl:param name="group"/>
  164.          
  165.          <!-- @ pre group code here -->
  166.          
  167.          <!-- - - -->
  168.  
  169.              <xsl:variable name="count" select="(position() - 1) * $group + 1"/>
  170.              
  171.              <xsl:for-each select="/session/content/document[$count <= position() and position() < ($count + $group)]">
  172.              
  173.                     <xsl:apply-templates select="."/>
  174.                    
  175.              </xsl:for-each>
  176.          
  177.          <!-- @ post group code here -->
  178.          
  179.          <!-- - - -->
  180.          
  181.      </xsl:template>
  182.  
  183.           
  184.      <xsl:template name="title">
  185.         <!--
  186.           @ Pre title html code here
  187.         -->
  188.         
  189.         <xsl:value-of select="/session/general-info/@title"/>
  190.         
  191.         <!--
  192.           @ Post title html code here
  193.         -->
  194.      </xsl:template>
  195.      
  196.      <!-- =============================
  197.              Document properties
  198.              
  199.      This section contains templates which
  200.      give the document properties...
  201.                    
  202.      ================================== -->
  203.      
  204.      <!-- this tempaltes gives the
  205.      relative href of the document. To use
  206.      with the <a href="..."> attribute-->
  207.     
  208.     
  209.      <xsl:template match="document" mode="href">
  210.        <xsl:value-of select="concat(../@directory,'/')"/>
  211.        <xsl:if test="@dir">
  212.          <xsl:value-of select="concat(@dir,'/')"/>
  213.        </xsl:if>
  214.        <xsl:value-of select="@fn"/>
  215.      </xsl:template>
  216.      
  217.      
  218.      <xsl:template match="document/@title">
  219.          <span class="doctitle">
  220.              <a>
  221.              <xsl:attribute name="href"> 
  222.                 <xsl:apply-templates select=".." mode="href"/>
  223.             </xsl:attribute> 
  224.             
  225.             <xsl:value-of select="."/>
  226.             </a>
  227.          </span>
  228.          <br/>
  229.      </xsl:template>
  230.      
  231.  
  232.      <xsl:template match="document/@description">
  233.          <span class="docdescription">
  234.              <xsl:value-of select="."/>
  235.          </span>
  236.          <br/>
  237.      </xsl:template>
  238.      
  239.  
  240.      <xsl:template match="document/@author">
  241.          <span class="docauthor">
  242.              <xsl:value-of select="."/>
  243.          </span>
  244.          <br/>
  245.      </xsl:template>
  246.      
  247.  
  248.      <xsl:template match="document/@create-date">
  249.          <span class="doccreationdate">
  250.              <xsl:value-of select="."/>
  251.          </span>
  252.          <br/>
  253.      </xsl:template>
  254.      
  255.  
  256.      <xsl:template match="document/@update-date">
  257.          <span class="doclastchangedate">
  258.              <xsl:value-of select="."/>
  259.          </span>
  260.          <br/>
  261.      </xsl:template>
  262.      
  263.  
  264.      <xsl:template match="document/@filename">
  265.          <span class="docfilename">
  266.              <xsl:value-of select="."/>
  267.          </span>
  268.          <br/>
  269.      </xsl:template>
  270.  
  271.  
  272.      <xsl:template match="document/@format">
  273.          <span class="docfileformatinfo">
  274.              <xsl:value-of select="."/>
  275.          </span>
  276.          <br/>
  277.      </xsl:template>
  278.  
  279.  
  280.      <xsl:template match="document/@pages">
  281.          <span class="docnumberofpages">
  282.              <xsl:value-of select="."/>
  283.          </span>
  284.          <br/>
  285.      </xsl:template>
  286.      
  287.  
  288.      <xsl:template match="document/@size">
  289.          <span class="docsizeinkb">
  290.              <xsl:value-of select="."/>
  291.          </span>
  292.          <br/>
  293.      </xsl:template>
  294.      
  295.      <xsl:template match="document/@icon">
  296.        <img src="images/{.}"/>
  297.          <br/>
  298.      </xsl:template>
  299.     
  300.  
  301.      <!-- =============================
  302.                    HTML HEAD
  303.                    
  304.     this section should not be changed
  305.      ================================== -->
  306.      
  307.      <xsl:template name="head">
  308.          <head>
  309.                 <title>
  310.                      <xsl:value-of select="/session/general-info/@title"/>
  311.                 </title>
  312.                 <!-- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -->
  313.                 <meta HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8"/>
  314.                 <meta name="description" content="{/session/general-info/@description}"/>
  315.                 <meta name="keywords" content="{/session/general-info/@keywords}"/>
  316.                 <meta name="author" content="{/session/general-info/@author}"/>
  317.                 <meta name="email" content="{/session/general-info/@email}"/>
  318.                 <meta name="copyright" content="{/session/general-info/@copyright}"/>
  319.                 <!-- create date?
  320.                      update date?
  321.                      fav icon?
  322.                      -->
  323.              <link href="style.css" rel="stylesheet" type="text/css"/>
  324.  
  325.         </head>
  326.      </xsl:template>
  327.          
  328. </xsl:stylesheet>
  329.