Rocky111
Rocky111

Reputation: 255

How to assign the value of Select to other variable in XSLT?

<td>
    <xsl:value-of select="sum(//Form[@PRONME = current()/@PRONME]/@TBONUSP)" />
</td>    
<td>
    <xsl:value-of select="sum(//Form[@PRONME = current()/@PRONME]/@NACRES)" />
</td>
<td>
    <xsl:value-of select=" First <TD> Value divided by Second)" />
</td>

I have a problem with printing third TD which is the Division of first two. how do i do? How to get the value?

Upvotes: 1

Views: 497

Answers (1)

Emiliano Poggi
Emiliano Poggi

Reputation: 24816

You could define your values in separate variables and refer them later.


[XSLT 1.0]

    <xsl:variable name="vFirst" select="sum(//Form[@PRONME = current()/@PRONME]/@TBONUSP)"/>
    <xsl:variable name="vSecond" select="sum(//Form[@PRONME = current()/@PRONME]/@NACRES)"/>
    <td>
        <xsl:value-of select="$vFirst"/>
    </td>
    <td>
        <xsl:value-of select="$vSecond"/>
    </td>
    <td>
        <xsl:value-of select="$vFirst div $vSecond"/>
    </td>

Upvotes: 2

Related Questions