次のデータがあります。
XML
<team>
<rectx>30</rectx>
<diadata>
<bestAnd>-350</bestAnd>
</diadata>
<diadata>
<bestAnd>-250</bestAnd>
</diadata>
<diadata>
<bestAnd>-50</bestAnd>
</diadata>
</team>
XSL
<xsl:variable name="list">
<xsl:value-of select="'M'" />
<xsl:for-each select="/team/diadata/bestAnd">
<xsl:choose>
<xsl:when test=". <0">
<xsl:value-of select=".*-1+400" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="." />
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="position" select="position()" />
<xsl:value-of select="concat(/team/rectx*$position+40,' ',.,' L')" />
</xsl:for-each>
</xsl:variable>
<xsl:variable name="finallist">
<xsl:value-of select="substring($list, 1, string-length($list) - 2)" />
</xsl:variable>
<text x="250" y="50"
style="font-family: Arial;
font-size : 24;
stroke : #000000;
fill : #000000;">
<xsl:value-of select="$finallist" />
</text>
出力は
M70 750 L100 650 L130 450
ただし、choose ステートメントでは
M75070 -350 L650100 -250 L450130 -50
したがって、「文字」「計算後のy-val」「x-val」「y-val」を行います
なぜ concat が choose ステートメントで機能しないのか理解できませんが、それがなければうまく機能します。問題は、負の数を使用することはできませんが、代わりに負の数を取得して正の数 (*-1) に変換し、400 を追加する必要があることです。
何か案は?