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 / forms-htmlarea-styling.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.7 KB  |  70 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. <xsl:stylesheet version="1.0"
  18.                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  19.                 xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
  20.                 exclude-result-prefixes="fi">
  21.   <!--+
  22.       | This stylesheet is designed to be included by 'forms-advanced-styling.xsl'.
  23.       +-->
  24.  
  25.   <!-- Location of the resources directory, where JS libs and icons are stored -->
  26.   <xsl:param name="resources-uri">resources</xsl:param>
  27.   <xsl:param name="htmlarea-lang">en</xsl:param>
  28.  
  29.   <xsl:template match="head" mode="forms-htmlarea">
  30.     <script type="text/javascript">
  31.       _editor_url = "<xsl:value-of select="concat($resources-uri, '/htmlarea/')"/>";
  32.       _editor_lang = "<xsl:value-of select="$htmlarea-lang"/>";
  33.     </script>
  34.     <script type="text/javascript" src="{$resources-uri}/htmlarea/htmlarea.js"></script>
  35.   </xsl:template>
  36.  
  37.   <xsl:template match="body" mode="forms-htmlarea"/>
  38.  
  39.   <!--+
  40.       | fi:field with @type 'htmlarea'
  41.       +-->
  42.   <xsl:template match="fi:field[fi:styling[@type='htmlarea']]">
  43.     <textarea id="{@id}" name="{@id}" title="{fi:hint}">
  44.       <xsl:apply-templates select="." mode="styling"/>
  45.       <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks at each submit) -->
  46.       <xsl:apply-templates select="fi:value/node()" mode="htmlarea-copy"/>
  47.     </textarea>
  48.     <xsl:apply-templates select="." mode="common"/>
  49.     <xsl:choose>
  50.       <xsl:when test="fi:styling/initFunction">
  51.         <script language="JavaScript"><xsl:value-of select="fi:styling/initFunction"/>('<xsl:value-of select="@id"/>');</script>
  52.       </xsl:when>
  53.       <xsl:otherwise>
  54.         <script language="JavaScript">HTMLArea.replace('<xsl:value-of select="@id"/>');</script>        
  55.       </xsl:otherwise>
  56.     </xsl:choose>
  57.   </xsl:template>
  58.  
  59.   <xsl:template match="@*|*" mode="htmlarea-copy">
  60.     <xsl:copy>
  61.       <xsl:apply-templates select="@*|node()" mode="htmlarea-copy"/>
  62.     </xsl:copy>
  63.   </xsl:template>
  64.  
  65.   <xsl:template match="text()" mode="htmlarea-copy">
  66.     <xsl:copy-of select="translate(., ' ', '')"/>
  67.   </xsl:template>
  68.  
  69. </xsl:stylesheet>
  70.