cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r265718 - /cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
Date Thu, 01 Sep 2005 13:31:34 GMT
Author: sylvain
Date: Thu Sep  1 06:31:31 2005
New Revision: 265718

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

Modified:
    cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl

Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl?rev=265718&r1=265717&r2=265718&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
(original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
Thu Sep  1 06:31:31 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>
 
   <!--+



Mime
View raw message