xml - xslt for-each statement displaying duplicates -



xml - xslt for-each statement displaying duplicates -

this xml:

<root> ... <payment-schedule> <loan> <l-number id='0'>00321-123456789-01</l-number> <financed id='0'>2500.0000</financed> </loan> <loan> <l-number id='1'>00321-123456789-02</l-number> <financed id='1'>3000.0000</financed> </loan> </payment-schedule> </root>

this xslt:

<!--repeating rows displays loans--> <xsl:apply-templates select="loan"/> </xsl:template> <xsl:template match="loan"> <xsl:for-each select="/root/payment-schedule/loan"> <fo:table-row> <fo:table-cell border-right-style="solid" border-width="0.2mm" padding-left="2mm"> </fo:table-cell> <fo:table-cell border-right-style="solid" border-width="0.2mm" padding-left="2mm"> <fo:block font-weight="bold"> <xsl:value-of select="l-number" />: $<xsl:value-of select='format-number(financed, "#.00")'/> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> </xsl:template>

here output:

00321-123456789-01: $2500.00 00321-123456789-02: $3500.00 00321-123456789-01: $2500.00 00321-123456789-02: $3500.00

i have spent way much time trying remove these duplicate nodes. help!!!!

you have template fires 1 time each loan, , in template you're 1 time again doing for-each on loan elements. remove for-each , should result require.

<xsl:template match="loan"> <fo:table-row> <!-- ... -->

xml xslt xsl-fo

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -