Nested FOR - EACH PROBLEM

P

Pheckz

Hi I have a nested for each but it does not display my desire output


Here is the xml:



<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table>

<assoc_type>BD</assoc_type>
<assoc_ofc>hong kong </assoc_ofc>
<assoc_initial>FB </assoc_initial>
<rcv_rcvl>2</rcv_rcvl>
<gyear>2002</gyear>
<doc_positionID>875000048</doc_positionID>
<doc_id>875000038</doc_id>
<source>1</source>
<inv_main_id>877000032</inv_main_id>
</Table>
<Table>

<assoc_type>BD</assoc_type>
<assoc_ofc>hong kong </assoc_ofc>
<assoc_initial>FR </assoc_initial>
<rcv_rcvl>2</rcv_rcvl>
<gyear>2002</gyear>
<doc_positionID>875000048</doc_positionID>
<doc_id>875000038</doc_id>
<source>1</source>
<inv_main_id>877000032</inv_main_id>
</Table>
<Table>

<assoc_type>BD</assoc_type>
<assoc_ofc>hong kong </assoc_ofc>
<assoc_initial>FC </assoc_initial>
<rcv_rcvl>2</rcv_rcvl>
<gyear>2002</gyear>
<doc_positionID>875000048</doc_positionID>
<doc_id>875000038</doc_id>
<source>1</source>
<inv_main_id>877000032</inv_main_id>
</Table>

<NewDataSet>


the xslt is:



<xsl:for-each select="NewDataSet/Table[inv_main_id[not(. =
preceding::inv_main_id)] and assoc_type='BD' and gyear='2002' and
rcv_rcvl='2']">
<xsl:variable name="Vinv_main_id">
<xsl:value-of select="inv_main_id"/>
</xsl:variable>

<td><xsl:value-of select="gyear"/></td>
<xsl:for-each

select="NewDataSet/Table[inv_main_id=$Vinv_main_id]">
<td><xsl:value-of select="assoc_initial"/></TD>
</xsl:for-each
</xsl:for-each

this is what the output should
be:


2002 FBFRFC


however it did not displayed any problems but the output is only:


2002


it seems it doesn't execute the second for-each loop.
Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top