From: Jan Pokorný <jpokorny@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCHv2 4/6] rgmanager: ra2rng.xsl: control flow branches common business merge
Date: Mon, 9 Dec 2013 15:14:17 +0100 [thread overview]
Message-ID: <1386598457-14576-1-git-send-email-jpokorny@redhat.com> (raw)
In-Reply-To: <1386095178-23404-5-git-send-email-jpokorny@redhat.com>
... 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@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
next prev parent reply other threads:[~2013-12-09 14:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 18:26 [Cluster-devel] [resource-agents][PATCH 0/6] rgmanager: ra2rng.xsl: build up param datatyping infra Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 1/6] rgmanager: ra2rng.xsl: extend infrastructure for XML Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 2/6] rgmanager: ra2rng.xsl: make common params reuse XML pretty-print Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 3/6] rgmanager: ra2rng.xsl: common params: prevent misleading combination Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 4/6] rgmanager: ra2rng.xsl: control flow branches common business merge Jan Pokorný
2013-12-09 14:14 ` Jan Pokorný [this message]
2013-12-03 18:26 ` [Cluster-devel] [PATCH 5/6] rgmanager: ra2rng.xsl: infra for param value datatyping/restriction Jan Pokorný
2013-12-09 14:15 ` [Cluster-devel] [PATCHv2 " Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 6/6] gmanager: ra2rng.xsl: script-file: try to prevent cluster's services Jan Pokorný
2013-12-03 18:31 ` Jan Pokorný
2013-12-03 18:26 ` [Cluster-devel] [PATCH 6/6] rgmanager: " Jan Pokorný
2013-12-04 13:50 ` [Cluster-devel] [PATCHv2 " Jan Pokorný
2013-12-09 14:16 ` [Cluster-devel] [PATCHv3 " Jan Pokorný
2013-12-05 17:13 ` [Cluster-devel] [PATCHv2 3/6] rgmanager: ra2rng.xsl: common params: prevent misleading combination Jan Pokorný
2013-12-09 14:12 ` [Cluster-devel] [PATCHv3 " Jan Pokorný
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386598457-14576-1-git-send-email-jpokorny@redhat.com \
--to=jpokorny@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).