I have an XML File:
<year final_ind="No" year_no="24">
<sum_contributions>73137.60</sum_contributions>
<sum_growth>127048.51</sum_growth>
<sum_gross_fund_value>202660.53</sum_gross_fund_value>
<sum_net_fund_value>181598.03</sum_net_fund_value>
<pv_sum_gross_fund_value>79062.23</pv_sum_gross_fund_value>
<pv_sum_net_fund_value>70845.29</pv_sum_net_fund_value>
<sum_expenses>21062.50</sum_expenses>
<sum_protection_costs>0.00</sum_protection_costs>
</year>
<year final_ind="Yes" year_no="25">
<sum_contributions>74153.40</sum_contributions>
<sum_growth>132101.67</sum_growth>
<sum_gross_fund_value>208729.49</sum_gross_fund_value>
<sum_net_fund_value>186991.42</sum_net_fund_value>
<pv_sum_gross_fund_value>80248.51</pv_sum_gross_fund_value>
<pv_sum_net_fund_value>71891.06</pv_sum_net_fund_value>
<sum_expenses>21738.07</sum_expenses>
<sum_protection_costs>0.00</sum_protection_costs>
</year>
I want to find year_no (25) where final_ind = 'Yes'
and then process year_no - 1 (24)
Below is a test XSLT which correctly select the final_ind = 'Yes' Node but I don't know how to continue..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl
utput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/message">
<FinalYear>
<xsl:variable name="FinalYear" select="m-content/application/document_out/yearly_values[@growth_rate_type='Standard']/year[@final_ind='Yes'][@year_no]">
</xsl:variable>
<xsl:variable name="AnnYear" select="$FinalYear">
</xsl:variable>
</FinalYear>
</xsl:template>
</xsl:stylesheet>
<year final_ind="No" year_no="24">
<sum_contributions>73137.60</sum_contributions>
<sum_growth>127048.51</sum_growth>
<sum_gross_fund_value>202660.53</sum_gross_fund_value>
<sum_net_fund_value>181598.03</sum_net_fund_value>
<pv_sum_gross_fund_value>79062.23</pv_sum_gross_fund_value>
<pv_sum_net_fund_value>70845.29</pv_sum_net_fund_value>
<sum_expenses>21062.50</sum_expenses>
<sum_protection_costs>0.00</sum_protection_costs>
</year>
<year final_ind="Yes" year_no="25">
<sum_contributions>74153.40</sum_contributions>
<sum_growth>132101.67</sum_growth>
<sum_gross_fund_value>208729.49</sum_gross_fund_value>
<sum_net_fund_value>186991.42</sum_net_fund_value>
<pv_sum_gross_fund_value>80248.51</pv_sum_gross_fund_value>
<pv_sum_net_fund_value>71891.06</pv_sum_net_fund_value>
<sum_expenses>21738.07</sum_expenses>
<sum_protection_costs>0.00</sum_protection_costs>
</year>
I want to find year_no (25) where final_ind = 'Yes'
and then process year_no - 1 (24)
Below is a test XSLT which correctly select the final_ind = 'Yes' Node but I don't know how to continue..
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl
<xsl:template match="/message">
<FinalYear>
<xsl:variable name="FinalYear" select="m-content/application/document_out/yearly_values[@growth_rate_type='Standard']/year[@final_ind='Yes'][@year_no]">
</xsl:variable>
<xsl:variable name="AnnYear" select="$FinalYear">
</xsl:variable>
</FinalYear>
</xsl:template>
</xsl:stylesheet>