How to create dynamic numbering in xsl fo list block? I am using the code below and the list items are generated on based on condition. In case the condition does not match, the section does not print but it disturbs the order. For example if the second condition does not match, then it prints 1,3,4,5 but my requirement is to print 1,2,3,4 (dynamic numbering).
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUST_FIN_RQ = '1'">
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1'">
<fo:block text-align="justify" space-after="18pt" space-after.conditionality="retain">
<fo:list-block>
<fo:list-item>
<fo:list-item-label start-indent="120pt">
<fo:block>
<fo:inline>(i)</fo:inline>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="75pt" text-indent="0pt">
<fo:block>
<fo:inline>
<fo:leader leader-length="75pt" />Within </fo:inline>
<fo:inline>
<xsl:call-template name="num-to-word">
<xsl:with-param name="value" select="//CO/UD_DO_CUS_MON_STM_DYS" />
</xsl:call-template>
</fo:inline>
<fo:inline> (</fo:inline>
<fo:inline>
<xsl:value-of select="//CO/UD_DO_CUS_MON_STM_DYS" />
</fo:inline>
<fo:inline>) days after the end of each month, a copy of Lessee’s</fo:inline>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_INT_STM_PRP = '1'">
<fo:inline> internally prepared consolidated financial statements for that month and for the year to date in a form reasonably acceptable to Lessor, prepared</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline> financial statements for that month and for the year to date compiled by a firm of independent certified public accountants acceptable to Lessor, (which acceptance shall not be unreasonably withheld)</fo:inline>
</xsl:otherwise>
</xsl:choose>
<fo:inline>and certified as complete and correct, subject to changes resulting from year-end adjustments, by</fo:inline>
<xsl:choose>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '12' and $VarRP = '0'">
<fo:inline> Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '21'">
<fo:inline> the trustee of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '06'">
<fo:inline> the chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '11' and //IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '14'">
<fo:inline> a general partner of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '13'">
<fo:inline> a member, managing member or other chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline> the chief financial officer, manager, member, partner, trustee or other representative of such Lessee. </fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUST_FIN_QTLY = '1'">
<fo:block text-align="justify" space-after="18pt" space-after.conditionality="retain">
<fo:list-block>
<fo:list-item>
<fo:list-item-label start-indent="120pt">
<fo:block>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline>(i)</fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="75pt" text-indent="0pt">
<fo:block>
<fo:inline>
<fo:leader leader-length="75pt" />Within </fo:inline>
<fo:inline>
<xsl:call-template name="num-to-word">
<xsl:with-param name="value" select="//CO/UD_DO_CUS_QTLY_STM_DY" />
</xsl:call-template>
</fo:inline>
<fo:inline> (</fo:inline>
<fo:inline>
<xsl:value-of select="//CO/UD_DO_CUS_QTLY_STM_DY" />
</fo:inline>
<fo:inline>) days after the end of each quarter, a copy of Lessee’s</fo:inline>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_INT_STM_PRP = '1'">
<fo:inline> internally prepared consolidated financial statements for that month and for the year to date in a form reasonably acceptable to Lessor, prepared</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline> financial statements for that month and for the year to date compiled by a firm of independent certified public accountants acceptable to Lessor, (which acceptance shall not be unreasonably withheld)</fo:inline>
</xsl:otherwise>
</xsl:choose>
<fo:inline>and certified as complete and correct, subject to changes resulting from year-end adjustments, by</fo:inline>
<xsl:choose>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '12' and $VarRP = '0'">
<fo:inline> Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '21'">
<fo:inline> the trustee of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '06'">
<fo:inline> the chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '11' and //IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '14'">
<fo:inline> a general partner of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '13'">
<fo:inline> a member, managing member or other chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline> the chief financial officer, manager, member, partner, trustee or other representative of such Lessee. </fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUST_FIN_ANN = '1'">
<fo:block text-align="justify" space-after="18pt" space-after.conditionality="retain">
<fo:list-block>
<fo:list-item>
<fo:list-item-label start-indent="120pt">
<fo:block>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0'">
<fo:inline>(i)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline>(iii)</fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="75pt" text-indent="0pt">
<fo:block>
<fo:inline>
<fo:leader leader-length="75pt" />Within </fo:inline>
<fo:inline>
<xsl:call-template name="num-to-word">
<xsl:with-param name="value" select="//CO/UD_DO_CUS_ANN_STM_DAY" />
</xsl:call-template>
</fo:inline>
<fo:inline> (</fo:inline>
<fo:inline>
<xsl:value-of select="//CO/UD_DO_CUS_ANN_STM_DAY" />
</fo:inline>
<fo:inline>) days after the end of each quarter, a copy of Lessee’s</fo:inline>
<xsl:choose>
<xsl:when test="//IronData/CO/UD_DO_CUS_YND_STM_PRP = '3'">
<fo:inline> consolidated year end financial statements audited by a firm of independent certified public accountants acceptable to Lessor (which acceptance shall not be unreasonably withheld) and accompanied by an audit opinion of such accountants without qualification. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CO/UD_DO_CUS_YND_STM_PRP = '4'">
<fo:inline> consolidated year end financial statements reviewed by a firm of independent certified public accountants acceptable to Lessor (which acceptance shall not be unreasonably withheld) and accompanied by a review verification of such accountants without qualification. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CO/UD_DO_CUS_YND_STM_PRP = '2'">
<fo:inline> consolidated year end financial statements compiled by a firm of independent certified public accountants acceptable to Lessor (which acceptance shall not be unreasonably withheld) and certified as complete and correct by the principal financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CO/UD_DO_CUS_YND_STM_PRP = '1'">
<fo:inline> internally prepared consolidated financial statements for the year in a form reasonably acceptable to Lessor, prepared and certified as complete and correct by  </fo:inline>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '12' and $VarRP = '0'">
<fo:inline> Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '21'">
<fo:inline> the trustee of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '06'">
<fo:inline> the chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '11' and //IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '14'">
<fo:inline> a general partner of Lessee. </fo:inline>
</xsl:when>
<xsl:when test="//IronData/CUST_DATA/UD_CU_ENTITY_TYPE = '13'">
<fo:inline> a member, managing member or other chief financial officer of Lessee. </fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline> the chief financial officer, manager, member, partner, trustee or other representative of such Lessee. </fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:block text-align="justify" space-after="18pt" space-after.conditionality="retain">
<fo:list-block>
<fo:list-item>
<fo:list-item-label start-indent="120pt">
<fo:block>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1'">
<fo:inline>(iv)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0'">
<fo:inline>(i)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '0'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '1'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline>(iv)</fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="75pt" text-indent="0pt">
<fo:block>
<fo:inline>
<fo:leader leader-length="75pt" />A copy of Lessee’s federal income tax return with all schedules attached thereto (including, without limitation, all K-1 pro-rata share schedules relating to estates/trusts, partnerships, S-corporations or other entities), at the time such return is filed with the Internal Revenue Service and in any event within 120 days after the end of each calendar year.</fo:inline>
</fo:block>
<fo:block>
<fo:inline> </fo:inline>
</fo:block>
<fo:block>
<fo:inline>All such financial statements shall be prepared in accordance with generally accepted accounting principles, consistently applied. So long as Lessee is a reporting company under the Securities Exchange Act of 1934 and is timely filing the reports required thereunder to the Securities Exchange Commission, Lessee will have no obligation to furnish its financial statements as provided above.</fo:inline>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:when>
</xsl:choose>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_CVN_CMP_CRT = '1'">
<fo:block text-align="justify" space-after="18pt" space-after.conditionality="retain">
<fo:list-block>
<fo:list-item>
<fo:list-item-label start-indent="120pt">
<fo:block>
<xsl:choose>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(v)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(i)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(iv)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iv)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '0'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iv)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(ii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '1' and //CO/UD_DO_CUST_FIN_QTLY = '0' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '0' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iii)</fo:inline>
</xsl:when>
<xsl:when test="//CO/UD_DO_CUS_FIN_MNTHLY = '0' and //CO/UD_DO_CUST_FIN_QTLY = '1' and //CO/UD_DO_CUST_FIN_ANN = '1' and //CO/UD_DO_CUST_TAX_RTN_RQ = '1'">
<fo:inline>(iv)</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline>(v)</fo:inline>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="75pt" text-indent="0pt">
<fo:block>
<fo:inline>
<fo:leader leader-length="75pt" />Within </fo:inline>
<fo:inline>
<xsl:call-template name="num-to-word">
<xsl:with-param name="value" select="//CO/UD_DO_CUS_CMP_CERT_DY" />
</xsl:call-template>
</fo:inline>
<fo:inline> (</fo:inline>
<fo:inline>
<xsl:value-of select="//CO/UD_DO_CUS_CMP_CERT_DY" />
</fo:inline>
<fo:inline>) days after the end of each </fo:inline>
<fo:inline>
<xsl:value-of select="//CO/UD_DO_CST_CMP_CRT_FRQ/@Desc" />
</fo:inline>
<fo:inline>, a financial covenant compliance certificate, in form and substance reasonably acceptable to Lessor, which identifies the financial results of the applicable covenant period and compares the actual financial covenants and financial covenant ratios to the required financial covenants under this Agreement, and certified as complete and correct (subject to changes resulting from year-end adjustments) by the chief financial officer of Lessee.</fo:inline>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:when>
</xsl:choose>
</xsl:when>