[EMAIL PROTECTED] wrote:
Author: rfrovarp
Date: Fri Jun  1 08:54:11 2007
New Revision: 543517

URL: http://svn.apache.org/viewvc?view=rev&rev=543517
Log:
Transforms object tags into img tags so that FCKEditor can correctly identify 
images for modification. XSL modified from Kupu.

Added:
    lenya/trunk/src/modules/fckeditor/resources/xslt/
    lenya/trunk/src/modules/fckeditor/resources/xslt/content2edit.xsl
Modified:
    lenya/trunk/src/modules/fckeditor/sitemap.xmap

Added: lenya/trunk/src/modules/fckeditor/resources/xslt/content2edit.xsl
URL: 
http://svn.apache.org/viewvc/lenya/trunk/src/modules/fckeditor/resources/xslt/content2edit.xsl?view=auto&rev=543517
==============================================================================
--- lenya/trunk/src/modules/fckeditor/resources/xslt/content2edit.xsl (added)
+++ lenya/trunk/src/modules/fckeditor/resources/xslt/content2edit.xsl Fri Jun  
1 08:54:11 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+  Transforms page to be edited by FCKEditor wysiwyg xhtml editor.
+-->
+
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+  xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0";
+  xmlns:xhtml="http://www.w3.org/1999/xhtml";
+    xmlns:dc="http://purl.org/dc/elements/1.1/";
+  xmlns="http://www.w3.org/1999/xhtml";
+ >
+
+ <!-- this template converts the object tag to img (for compatiblity with older browsers + for more, see http://www.xml.com/pub/a/2003/07/02/dive.html -->
+   <xsl:template name="object2img">
+      <img border="0">
+        <xsl:attribute name="src">
+          <xsl:value-of select="@data"/>
+        </xsl:attribute>
+        <!-- use the rarely-used ismap to roundtrip the type attribute for the 
object element -->
+        <xsl:attribute name="ismap">
+          <xsl:value-of select="@type"/>
+        </xsl:attribute>
+        <xsl:attribute name="alt">
+          <!-- the overwritten title (stored in @name) has precedence over 
dc:title -->
+          <xsl:choose>
+            <xsl:when test="@name != ''">
+              <xsl:value-of select="@name"/>
+            </xsl:when>
+            <xsl:when test="@title != ''">
+              <xsl:value-of select="@title"/>
+            </xsl:when>
+            <xsl:otherwise>
+ <xsl:value-of select="dc:metadata/dc:title"/> + </xsl:otherwise>
+            </xsl:choose>
+        </xsl:attribute>
+         <xsl:if test="string(@height)">
+          <xsl:attribute name="height">
+            <xsl:value-of select="@height"/>
+          </xsl:attribute>
+ </xsl:if> + <xsl:if test="string(@width)">
+          <xsl:attribute name="width">
+            <xsl:value-of select="@width"/>
+          </xsl:attribute>
+ </xsl:if> + </img>
+   </xsl:template>
+ + <xsl:template match="xhtml:object" priority="3">
+    <xsl:choose>
+      <xsl:when test="@href != ''">
+        <a href="[EMAIL PROTECTED]">
+          <xsl:call-template name="object2img"/>
+        </a>
+      </xsl:when>
+      <xsl:when test="@type = 'application/x-shockwave-flash'">
+        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
+            <param name="movie" value="[EMAIL PROTECTED]"/>
+        </object>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object2img"/>
+      </xsl:otherwise>
+    </xsl:choose>
+ </xsl:template> +
+<xsl:template match="@*|node()">
+  <xsl:copy>
+    <xsl:apply-templates select="@*|node()"/>
+  </xsl:copy>
+</xsl:template> +
+</xsl:stylesheet>

This file is basically a slightly modified version of the one from Kupu. It was missing the ASF header, so I slapped it on. I just realized that the Kupu file isn't under our SVN (when I tried to svn commit a modified version of that file). You can find the original Kupu file at src/modules/kupu/apache-lenya/lenya/content2edit.xsl. What needs to be done to make everything okay with respect to licensing?

Thanks,
Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to