0

以前、同様の質問をしました。コードにいくつかの変更を加えましたが、まだ行き詰まっています。

次のような XSLT の一部があります。

      <xsl:variable name="y" select="0" />
      <xsl:if test="units_display='true'">
          <xsl:call-template name="DisplayBox">
            <xsl:with-param name="current_y" select="$y" />
            <xsl:with-param name="value" select="units" />
            <xsl:with-param name="text" select="'Units'" />
          </xsl:call-template>
      </xsl:if>
      <xsl:if test="sensor_display='true'">
          <xsl:call-template name="DisplayBox">
            <xsl:with-param name="current_y" select="$y" />
            <xsl:with-param name="value" select="sensor" />
            <xsl:with-param name="text" select="'Type'" />
          </xsl:call-template>
      </xsl:if>
      <xsl:if test="offset_display='true'">
          <xsl:call-template name="DisplayBox">
            <xsl:with-param name="current_y" select="$y" />
            <xsl:with-param name="value" select="offset" />
            <xsl:with-param name="text" select="'Offset'" />
          </xsl:call-template>
      </xsl:if>

私の呼び出しテンプレートは次のようなものです:

<xsl:template name="DisplayBox">
<xsl:param name="current_y" />
<xsl:param name="value" />
<xsl:param name="text" />
  <rect x="20" y="{150 + $current_y}" width="220" height="20" fill="#FFFFFF" stroke="black" stroke-width="1" />
  <text x="25" y="{168 + $current_y}" font-family="arial" font-size="20px" fill="black">
    <xsl:value-of select="$value"/>
  </text>
  <line x1="90" y1="{150 + $current_y}" x2="90" y2="{170 + $current_y}" stroke="black" stroke-width="1" />
  <text x="95" y="{168 + $current_y}" font-family="arial" font-size="20px" fill="black"><xsl:value-of select="$text" /></text>
</xsl:template>

if ステートメントが true かどうかによって current_y の値を増やす方法がわかりません。たとえば、ステートメントが true の場合、y の値を 20 増やす必要がありますが、ステートメントが false の場合は必要ありません。

したがって、3 つのステートメントがすべて false であるか、次の順列のいずれかである場合、出力は空になる可能性があります。

ここに画像の説明を入力

どんな助けでも大歓迎です。

4

1 に答える 1