... 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ý <jpoko...@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 5addc47..6c66ee3 100644 --- a/rgmanager/src/resources/ra2rng.xsl +++ b/rgmanager/src/resources/ra2rng.xsl @@ -328,48 +328,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"> @@ -381,8 +379,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