Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xslt - supress data if return = 0

Status
Not open for further replies.

robmason10

Technical User
Apr 9, 2002
68
GB
Firstly - apologies in advance I am novice at the extreme - I am stuck with no developers with an urgent defect so seeing if I can get a head start.

I have a sproc that feeds an xslt that feeds in to a word template. The template is currently showing repeating regions. If the balance is zero I need that instance to be supressed.

Function is "ShareTotal" and I need to put in a condition to supress - but I really do have no idea.....any helpers?

AnnualReturnShareMemberDetailsItem is the section to be supressed if TotalShareCount" is zero....

Code:

<xsl:template match="AnnualReturnShareMemberDetailsItem">

<xsl:variable name="Curr_ShareClassMemberID"><xsl:value-of select="ubintShareholderID"/></xsl:variable>
<xsl:variable name="Next_ShareClassMemberID"><xsl:value-of select="following-sibling::node()[1]/ubintShareholderID" /></xsl:variable>
<xsl:variable name="Prev_ShareClassMemberID"><xsl:value-of select=" preceding-sibling::node()[1]/ubintShareholderID" /></xsl:variable>

<xsl:variable name="Curr_strTypeName"><xsl:value-of select="strTypeName"/></xsl:variable>
<xsl:variable name="Next_strTypeName"><xsl:value-of select="following-sibling::node()[1]/strTypeName"/></xsl:variable>
<xsl:variable name="Prev_strTypeName"><xsl:value-of select="preceding-sibling::node()[1]/strTypeName"/></xsl:variable>

<xsl:variable name="Curr_strCurrencySymbol"><xsl:value-of select="strCurrencySymbol"/></xsl:variable>
<xsl:variable name="Next_strCurrencySymbol"><xsl:value-of select="following-sibling::node()[1]/strCurrencySymbol"/></xsl:variable>
<xsl:variable name="Prev_strCurrencySymbol"><xsl:value-of select="preceding-sibling::node()[1]/strCurrencySymbol"/></xsl:variable>

<!--<Test>

<xsl:value-of select="$Prev_ShareClassMemberID"/>,
<xsl:value-of select="$Curr_ShareClassMemberID" />,
<xsl:value-of select="$Next_ShareClassMemberID" />

<xsl:value-of select="$Prev_strCurrencySymbol" />,
<xsl:value-of select="$Curr_strCurrencySymbol" />,
<xsl:value-of select="$Next_strCurrencySymbol" />

<xsl:value-of select="$Prev_strTypeName" />,
<xsl:value-of select="$Curr_strTypeName" />,
<xsl:value-of select="$Next_strTypeName" />

</Test>-->

<xsl:if test="
($Curr_ShareClassMemberID != $Next_ShareClassMemberID or
$Curr_strTypeName != $Next_strTypeName or
$Curr_strCurrencySymbol != $Next_strCurrencySymbol )
and
($Curr_ShareClassMemberID != $Prev_ShareClassMemberID or
$Curr_strCurrencySymbol != $Prev_strCurrencySymbol or
$Curr_strTypeName != $Prev_strTypeName)">

<xsl:copy>
<XslTotalShareCount>
<xsl:value-of select="format-number(user:fnNewShareTotal(ShareCount),'0.000000')" />
</XslTotalShareCount>
<XslTotalAmountPaid>
<xsl:value-of select="format-number(user:fnNewAmountPaidTotal(TotalAmmountPaid),'#,##0.00')" />
</XslTotalAmountPaid>
<XslAmountPaidPerShare>
<xsl:value-of select="format-number(monAmountPaidPerShare,'#,##0.00')" />
</XslAmountPaidPerShare>
<xsl:apply-templates select='node()' />
</xsl:copy>
</xsl:if>

<xsl:if test="

($Curr_ShareClassMemberID = $Next_ShareClassMemberID
and $Curr_strTypeName = $Next_strTypeName
and $Curr_strCurrencySymbol= $Next_strCurrencySymbol)

and

($Curr_ShareClassMemberID != $Prev_ShareClassMemberID
or $Curr_strTypeName != $Prev_strTypeName
or $Curr_strCurrencySymbol != $Prev_strCurrencySymbol)">


<Workings>
<RunningTotalShareCount>
<xsl:value-of select="format-number(user:fnNewShareTotal(ShareCount),'0.000000')" />
</RunningTotalShareCount>
<RunningTotalAmountPaid>
<xsl:value-of select="user:fnNewAmountPaidTotal(TotalAmmountPaid)" />
</RunningTotalAmountPaid>
</Workings>
</xsl:if>

<xsl:if test="($Curr_ShareClassMemberID = $Next_ShareClassMemberID
and $Curr_strTypeName = $Next_strTypeName
and $Curr_strCurrencySymbol = $Next_strCurrencySymbol
and $Curr_ShareClassMemberID = $Prev_ShareClassMemberID
and $Curr_strTypeName = $Prev_strTypeName
and $Curr_strCurrencySymbol = $Prev_strCurrencySymbol)">

<Workings>
<RunningTotalShareCount>
<xsl:value-of select="user:fnShareTotal(ShareCount)" />
</RunningTotalShareCount>
<RunningTotalAmountPaid>
<xsl:value-of select="user:fnAmountPaidTotal(TotalAmmountPaid)" />
</RunningTotalAmountPaid>
</Workings>
</xsl:if>

<xsl:if test="

($Curr_ShareClassMemberID = $Prev_ShareClassMemberID
and $Curr_strTypeName = $Prev_strTypeName
and $Curr_strCurrencySymbol = $Prev_strCurrencySymbol)
and
(($Curr_ShareClassMemberID != $Next_ShareClassMemberID
or $Curr_strTypeName != $Next_strTypeName
or $Curr_strCurrencySymbol != $Next_strCurrencySymbol)
or
not($Next_ShareClassMemberID))">



<xsl:copy>
<XslTotalShareCount>
<xsl:value-of select="format-number(user:fnShareTotal(ShareCount),'0.000000')" />
</XslTotalShareCount>
<XslTotalAmountPaid>
<xsl:value-of select="format-number(user:fnAmountPaidTotal(TotalAmmountPaid),'#,##0.00')" />
</XslTotalAmountPaid>

<xsl:variable name="TotalShareCount"><xsl:value-of select="format-number(user:fnGetShareTotal(),'0.000000') "/></xsl:variable>
<xsl:variable name="TotalAmountPaid"><xsl:value-of select="format-number(user:fnGetTotalAmountPaid(),'0.000000')" /></xsl:variable>
<xsl:choose>
<xsl:when test="$TotalShareCount!= 0 and $TotalAmountPaid != 0">
<XslAmountPaidPerShare>
<xsl:value-of select="format-number($TotalAmountPaid div $TotalShareCount,'#,##0.00')"/>
</XslAmountPaidPerShare>
</xsl:when>
<xsl:eek:therwise>
<XslAmountPaidPerShare>0.00</XslAmountPaidPerShare>
</xsl:eek:therwise>
</xsl:choose>

<xsl:apply-templates select='node()' />
</xsl:copy>
</xsl:if>

</xsl:template>
 
Your apology is accepted. Unfortunately, I really do not understand your problem statement in enough detail to provide any help. Are you trying to suppress the application of this entire template if some condition is met? If so, then the answer is not in the template itself, but at the point where the template is applied.

Please try again. I'll try to help if I can understand the actual problem.

Tom Morrison
 
Sorry...

The output lists data on multiple shareholders (based on AnnualReturnShareMemberDetailsItem)

However if the Total Shares held (i.e. TotalShareCount) is zero then I do not want that AnnualReturnShareMemberDetailsItem shown on the list.

i.e. Currently shows:
Shareholder Num shares held
1 100
2 50
3 0
4 0
5 25

What I want to see is:
Shareholder Num shares held
1 100
2 50
5 25

Make sense?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top