robmason10
Technical User
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>
<xsltherwise>
<XslAmountPaidPerShare>0.00</XslAmountPaidPerShare>
</xsltherwise>
</xsl:choose>
<xsl:apply-templates select='node()' />
</xsl:copy>
</xsl:if>
</xsl:template>
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>
<xsltherwise>
<XslAmountPaidPerShare>0.00</XslAmountPaidPerShare>
</xsltherwise>
</xsl:choose>
<xsl:apply-templates select='node()' />
</xsl:copy>
</xsl:if>
</xsl:template>