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
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