[Cluster-devel] [PATCHv2 4/6] rgmanager: ra2rng.xsl: control flow branches common business merge
Jan Pokorný
jpokorny at redhat.com
Mon Dec 9 14:14:17 UTC 2013
... two branches of non-/optional RA-specific parameter under single
branch parametrized by the depth of indentation and conditionally
decorated with the respective additional tag.
Signed-off-by: Jan Pokorný <jpokorny at redhat.com>
---
rgmanager/src/resources/ra2rng.xsl | 84 +++++++++++++++++++-------------------
1 file changed, 41 insertions(+), 43 deletions(-)
diff --git a/rgmanager/src/resources/ra2rng.xsl b/rgmanager/src/resources/ra2rng.xsl
index 2579952..eb9f5b1 100644
--- a/rgmanager/src/resources/ra2rng.xsl
+++ b/rgmanager/src/resources/ra2rng.xsl
@@ -326,48 +326,46 @@
<xsl:value-of select="$NL"/>
<xsl:for-each select="parameters/parameter">
- <xsl:choose>
- <xsl:when test="@required = '1' or @primary = '1'">
- <!-- attribute name=... rha:description=... -->
- <xsl:call-template name="tag">
- <xsl:with-param name="name" select="'attribute'"/>
- <xsl:with-param name="attrs" select="concat(
- 'name=', $Q, @name, $Q, $SP,
- 'rha:description=', $Q, normalize-space(shortdesc), $Q)"/>
- <xsl:with-param name="indented"
- select="concat($global-init-indent,
- $global-indent,
- $global-indent,
- $global-indent)"/>
- </xsl:call-template>
- <xsl:value-of select="$NL"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- optional (start) -->
- <xsl:call-template name="tag-start">
- <xsl:with-param name="name" select="'optional'"/>
- <xsl:with-param name="indented"
- select="concat($global-init-indent,
- $global-indent,
- $global-indent,
- $global-indent)"/>
- </xsl:call-template>
- <xsl:value-of select="$NL"/>
+ <xsl:variable name="use-indented"
+ select="concat($global-init-indent,
+ $global-indent,
+ $global-indent,
+ $global-indent,
+ substring($global-indent, 1,
+ number(not(@required = '1'
+ or @primary = '1')) * 64))"/>
+ <xsl:if test="$use-indented != concat($global-init-indent,
+ $global-indent,
+ $global-indent,
+ $global-indent)">
+
+ <!-- optional (start) -->
+ <xsl:call-template name="tag-start">
+ <xsl:with-param name="name" select="'optional'"/>
+ <xsl:with-param name="indented"
+ select="concat($global-init-indent,
+ $global-indent,
+ $global-indent,
+ $global-indent)"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
+
+ </xsl:if>
+
+ <!-- attribute name=... rha:description=... -->
+ <xsl:call-template name="tag">
+ <xsl:with-param name="name" select="'attribute'"/>
+ <xsl:with-param name="attrs" select="concat(
+ 'name=', $Q, @name, $Q, $SP,
+ 'rha:description=', $Q, normalize-space(shortdesc), $Q)"/>
+ <xsl:with-param name="indented" select="$use-indented"/>
+ </xsl:call-template>
+ <xsl:value-of select="$NL"/>
- <!-- attribute name=... rha:description=... -->
- <xsl:call-template name="tag">
- <xsl:with-param name="name" select="'attribute'"/>
- <xsl:with-param name="attrs" select="concat(
- 'name=', $Q, @name, $Q, $SP,
- 'rha:description=', $Q, normalize-space(shortdesc), $Q)"/>
- <xsl:with-param name="indented"
- select="concat($global-init-indent,
- $global-indent,
- $global-indent,
- $global-indent,
- $global-indent)"/>
- </xsl:call-template>
- <xsl:value-of select="$NL"/>
+ <xsl:if test="$use-indented != concat($global-init-indent,
+ $global-indent,
+ $global-indent,
+ $global-indent)">
<!-- optional (end) -->
<xsl:call-template name="tag-end">
@@ -379,8 +377,8 @@
$global-indent)"/>
</xsl:call-template>
<xsl:value-of select="$NL"/>
- </xsl:otherwise>
- </xsl:choose>
+
+ </xsl:if>
</xsl:for-each>
<!-- group (end) -->
--
1.8.1.4
More information about the Cluster-devel
mailing list