You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/09/01 15:31:03 UTC

svn commit: r265716 - /cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl

Author: sylvain
Date: Thu Sep  1 06:31:00 2005
New Revision: 265716

URL: http://svn.apache.org/viewcvs?rev=265716&view=rev
Log:
Fix bug #35574, thanks to Jean-Baptiste Quenot <jb...@anyware-tech.com>

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=265716&r1=265715&r2=265716&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl Thu Sep  1 06:31:00 2005
@@ -139,11 +139,38 @@
     </xsl:if>
   </xsl:template>
 
+  <xsl:template name="apos-replace">
+    <xsl:param name="text"/>
+    <xsl:variable name="pattern">'</xsl:variable>
+    <xsl:choose>
+      <xsl:when test="contains($text,$pattern)">
+        <xsl:value-of select="substring-before($text,$pattern)"/>
+        <xsl:text>\'</xsl:text>
+        <xsl:call-template name="apos-replace">
+          <xsl:with-param name="text" 
+            select="substring-after($text,$pattern)"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <!--+
       |
       +-->
-  <xsl:template match="fi:validation-message | fi:validation-error">
-    <a href="#" class="forms-validation-message" onclick='alert("{normalize-space(.)}");return false;'>&#160;!&#160;</a>
+  <xsl:template match="fi:validation-message">
+    <a href="#" class="forms-validation-message">
+      <xsl:attribute name="onclick">
+        <xsl:text>alert('</xsl:text>
+        <xsl:call-template name="apos-replace">
+          <xsl:with-param name="text" select="normalize-space(.)"/>
+        </xsl:call-template>
+        <xsl:text>'); return false;</xsl:text>
+      </xsl:attribute>
+      <xsl:text>&#160;!&#160;</xsl:text>
+    </a>
   </xsl:template>
 
   <!--+