You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ch...@apache.org on 2006/02/21 08:35:43 UTC

svn commit: r379387 - in /lenya/trunk/src/webapp/lenya/xslt/cforms: add-xhtml-namespace.xsl strip-xhtml-namespace.xsl

Author: chestnut
Date: Mon Feb 20 23:35:42 2006
New Revision: 379387

URL: http://svn.apache.org/viewcvs?rev=379387&view=rev
Log:
remove xhtml ns and add xhtml ns so that one can use <fi:styling type="htmlarea"><conf>...</conf></fi:styling> in cform 
usecases

Modified:
    lenya/trunk/src/webapp/lenya/xslt/cforms/add-xhtml-namespace.xsl
    lenya/trunk/src/webapp/lenya/xslt/cforms/strip-xhtml-namespace.xsl

Modified: lenya/trunk/src/webapp/lenya/xslt/cforms/add-xhtml-namespace.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/cforms/add-xhtml-namespace.xsl?rev=379387&r1=379386&r2=379387&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/cforms/add-xhtml-namespace.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/cforms/add-xhtml-namespace.xsl Mon Feb 20 23:35:42 2006
@@ -15,18 +15,28 @@
   limitations under the License.
 -->
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  xmlns:xhtml="http://www.w3.org/1999/xhtml">
 
-  <xsl:template match="head">
-    <head>
-      <xsl:apply-templates select="@*|node()"/>
-    </head>
+  <xsl:template match="*[namespace-uri()='']">
+    <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
+      <xsl:apply-templates select="@*|node()|text()"/>
+    </xsl:element>
   </xsl:template>
-
-  <xsl:template match="body">
-    <body>
-      <xsl:apply-templates select="@*|node()"/>
-    </body>
+  
+    <!--
+    Workaround to prevent the serializer from collapsing these
+    elements, since browsers currently can not handle things like
+      <textarea/>
+    The XHTML serializer currently used by Lenya can not be
+    configured to avoid this collapsing; as long as that is the case
+    this workaround is needed.
+    -->  
+  <xsl:template match="node()[local-name() = 'textarea' or local-name() = 'script' or local-name() = 'style']">
+   <xsl:element name="{local-name()}" namespace="http://www.w3.org/1999/xhtml">
+      <xsl:copy-of select="@*"/>
+      <xsl:apply-templates/>
+	  <xsl:if test="string-length(.) = 0"><xsl:text> </xsl:text></xsl:if>
+    </xsl:element>
   </xsl:template>
 
   <xsl:template match="@*|node()">

Modified: lenya/trunk/src/webapp/lenya/xslt/cforms/strip-xhtml-namespace.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/cforms/strip-xhtml-namespace.xsl?rev=379387&r1=379386&r2=379387&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/cforms/strip-xhtml-namespace.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/cforms/strip-xhtml-namespace.xsl Mon Feb 20 23:35:42 2006
@@ -17,17 +17,13 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xhtml="http://www.w3.org/1999/xhtml">
 
-  <xsl:template match="xhtml:head">
-    <head>
-      <xsl:apply-templates select="@*|node()"/>
-    </head>
+  <xsl:template match="xhtml:*">
+    <xsl:element name="{local-name()}">
+      <xsl:apply-templates select="@*|node()|text()"/>
+    </xsl:element>
   </xsl:template>
 
-  <xsl:template match="xhtml:body">
-    <body>
-      <xsl:apply-templates select="@*|node()"/>
-    </body>
-  </xsl:template>
+
 
   <xsl:template match="@*|node()">
     <xsl:copy>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org