Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ListOfAFGFINSApplicationIncomeandExpensesFormFill>
- <AFGFINSApplicationIncomeandExpenses>
- <AFGSubCategory>Rental Expense</AFGSubCategory>
- <Amount>2000</Amount>
- <Frequency>Quarterly</Frequency>
- </AFGFINSApplicationIncomeandExpenses>
- <AFGFINSApplicationIncomeandExpenses>
- <AFGSubCategory>Child Maintenance Paid</AFGSubCategory>
- <Amount>1000</Amount>
- <Frequency>4 Weekly</Frequency>
- </AFGFINSApplicationIncomeandExpenses>
- </ListOfAFGFINSApplicationIncomeandExpensesFormFill>
- <xsl:template match="ListOfAFGFINSApplicationIncomeandExpensesFormFill/AFGFINSApplicationIncomeandExpenses
- [AFGSubCategory = ('Child Maintenance Paid', 'Rental Expense')]" mode="OtherCommitment">
- <OtherCommitment
- UniqueID="{fn:UniqueID(Id)}">
- <xsl:attribute name="Amount">
- <xsl:apply-templates select="." mode="Amount"/>
- </xsl:attribute>
- <xsl:attribute name="Frequency" select="fn:IncomeFrequency(Frequency)"/>
- <xsl:attribute name="Category">
- <xsl:choose>
- <xsl:when test="AFGSubCategory = 'Child Maintenance Paid'">Child Maintenance</xsl:when>
- <xsl:when test="AFGSubCategory = 'Rental Expense'">Rent</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- </OtherCommitment>
- <xsl:template match="node()" mode="Amount">
- <xsl:choose>
- <xsl:when test="Frequency = '4 Weekly'">
- <xsl:value-of select="(Amount * 13) div 12"/>
- </xsl:when>
- <xsl:when test="Frequency = 'Quarterly'">
- <xsl:value-of select="Amount * 4"/>
- </xsl:when>
- <xsl:when test="Frequency != ''">
- <xsl:value-of select="Amount"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:function name="fn:IncomeFrequency">
- <xsl:param name="Frequency"/>
- <xsl:choose>
- <xsl:when test="$Frequency = '4 Weekly'">Monthly</xsl:when>
- <xsl:when test="$Frequency = 'Annually'">Yearly</xsl:when>
- <xsl:when test="$Frequency = 'Quarterly'">Yearly</xsl:when>
- <xsl:when test="$Frequency != ''">
- <xsl:value-of select="$Frequency"/>
- </xsl:when>
- <xsl:when test="$Frequency/../AFGAnnualAmount != ''">Yearly</xsl:when>
- </xsl:choose>
- </xsl:function>
- <OtherCommitment Amount="8000" Frequency="Yearly"
- Category="Rent">
- </OtherCommitment>
- <OtherCommitment Amount="1083.3333333333333"
- Frequency="Monthly"
- Category="Child Maintenance">
- </OtherCommitment>
- <ListOfAFGFINSApplicationIncomeandExpensesFormFill>
- <AFGFINSApplicationIncomeandExpenses>
- <AFGSubCategory>Rental Expense</AFGSubCategory>
- <Amount>2000</Amount>
- <Frequency>Quarterly</Frequency>
- </AFGFINSApplicationIncomeandExpenses>
- <AFGFINSApplicationIncomeandExpenses>
- <AFGSubCategory>Rental Expense</AFGSubCategory>
- <Amount>1000</Amount>
- <Frequency>Mounthly</Frequency>
- </AFGFINSApplicationIncomeandExpenses>
- <AFGFINSApplicationIncomeandExpenses>
- <AFGSubCategory>Child Maintenance Paid</AFGSubCategory>
- <Amount>1000</Amount>
- <Frequency>4 Weekly</Frequency>
- </AFGFINSApplicationIncomeandExpenses>
- </ListOfAFGFINSApplicationIncomeandExpensesFormFill>
- <OtherCommitment Amount="1666.6666666666667" Frequency="Monthly"
- Category="Rent">
- </OtherCommitment>
- <!-- This will keep the first approach because is only one 'Child Maintenance'-->
- <OtherCommitment Amount="1083.3333333333333"
- Frequency="Monthly"
- Category="Child Maintenance">
- </OtherCommitment>
- <xsl:template match="node()" mode="AmountMonthly">
- <xsl:choose>
- <xsl:when test="Frequency = 'Weekly'">
- <xsl:value-of select="fn:remove-scientific-notation((Amount * 52) div 12)"/>
- </xsl:when>
- <xsl:when test="Frequency = 'Fortnightly'">
- <xsl:value-of select="fn:remove-scientific-notation((Amount * 26) div 12)"/>
- </xsl:when>
- <xsl:when test="Frequency = '4 Weekly'">
- <xsl:value-of select="fn:remove-scientific-notation((Amount * 13) div 12)"/>
- </xsl:when>
- <xsl:when test="Frequency = 'Monthly'">
- <xsl:value-of select="Amount"/>
- </xsl:when>
- <xsl:when test="Frequency = 'Quarterly'">
- <xsl:value-of select="fn:remove-scientific-notation((Amount * 4) div 12)"/>
- </xsl:when>
- <xsl:when test="Frequency = 'Annually'">
- <xsl:value-of select="fn:remove-scientific-notation(Amount div 12)"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement