[xsl] Embedded xsl:for-each

Subject: [xsl] Embedded xsl:for-each
From: "Mark Williams" <mark@xxxxxxxxxxx>
Date: Tue, 30 Dec 2003 13:39:32 -0000

I'm trying to embed for-each statements within each other, but I am having
problems.  Take as an example the following XML file


and the following excerpt from a fo file:

<xsl:for-each select="data/Table1">

<xsl:for-each select="Table2">

<fo:block font-family="Times-Roman" font-size="12pt" text-align="justify"

<xsl:if test="position() = 1">Sum value = <xsl:value-of

Policy No= <xsl:value-of select="TablePolicy_No"/>




I was expecting this to produce the following:

Sum value = 123.00 Policy No = 123456

Policy No = 789101112

Sum value = 12.25 Policy No = 12

Policy No = 789

Instead it is producing

Sum value = Policy No =123456

Sum Value = 12.25 Policy No = 12

I can understand why the sum value is not generated as it is looking for SUM
as a child of Table2 when in fact it is a child of Table1.  How do I obtain
the value of SUM in this situation.

I don't understand why I am only getting 1 policy no value for each
repetition of Table1 with its nested repetition of Table2.

Any help would be appreciated.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread