Blame SOURCES/bz1207982-fence2rng-quotes.patch

44709c
From 4bedbd33645d22a4da2c623ccccacb2175d49b99 Mon Sep 17 00:00:00 2001
44709c
From: Marek 'marx' Grac <mgrac@redhat.com>
44709c
Date: Wed, 17 Jun 2015 19:57:05 +0200
44709c
Subject: [PATCH 10/10] fence2rng.xsl: Correctly handle quotes in description
44709c
44709c
Resolves: rhbz#1207982
44709c
---
44709c
 fence/agents/lib/fence2rng.xsl | 25 ++++++++++++++++++++++++-
44709c
 1 file changed, 24 insertions(+), 1 deletion(-)
44709c
44709c
diff --git a/fence/agents/lib/fence2rng.xsl b/fence/agents/lib/fence2rng.xsl
44709c
index 432bc89..f6d465e 100644
44709c
--- a/fence/agents/lib/fence2rng.xsl
44709c
+++ b/fence/agents/lib/fence2rng.xsl
44709c
@@ -124,6 +124,12 @@
44709c
         <xsl:value-of select="$NL"/>
44709c
 
44709c
         <xsl:for-each select="parameters/parameter">
44709c
+            <xsl:variable name="escapeddesc">
44709c
+                <xsl:call-template name="escape_quot">
44709c
+                    <xsl:with-param name="replace" select="shortdesc"/>
44709c
+                </xsl:call-template>
44709c
+        </xsl:variable>
44709c
+
44709c
             
44709c
             <xsl:call-template name="tag-start">
44709c
                 <xsl:with-param name="name" select="'optional'"/>
44709c
@@ -136,7 +142,7 @@
44709c
                 <xsl:with-param name="name" select="'attribute'"/>
44709c
                 
44709c
                     'name=',            $Q, @name,                      $Q, $SP,
44709c
-                    'rha:description=', $Q, normalize-space(shortdesc), $Q, $SP)"/>
44709c
+                    'rha:description=', $Q, normalize-space($escapeddesc), $Q, $SP)"/>
44709c
                 <xsl:with-param name="indent" select="concat($indent, $indent)"/>
44709c
             </xsl:call-template>
44709c
             <xsl:value-of select="$NL"/>
44709c
@@ -158,4 +164,21 @@
44709c
     <xsl:value-of select="$NL"/>
44709c
 </xsl:template>
44709c
 
44709c
+<xsl:template name="escape_quot">
44709c
+    <xsl:param name="replace"/>
44709c
+    <xsl:choose>
44709c
+        <xsl:when test="contains($replace,'"')">
44709c
+            <xsl:value-of select="substring-before($replace,'"')"/>
44709c
+            
44709c
+            <xsl:text>&quot;</xsl:text>
44709c
+            <xsl:call-template name="escape_quot">
44709c
+                <xsl:with-param name="replace" select="substring-after($replace,'"')"/>
44709c
+            </xsl:call-template>
44709c
+        </xsl:when>
44709c
+    <xsl:otherwise>
44709c
+        <xsl:value-of select="$replace"/>
44709c
+    </xsl:otherwise>
44709c
+    </xsl:choose>
44709c
+    </xsl:template>
44709c
+
44709c
 </xsl:stylesheet>
44709c
-- 
44709c
1.9.3
44709c