What you do is wrong for what you want to achieve:
<xsl:for-each select="*[name()='PartInformation']"> <table bgcolor="#99ff66"><th>Part Information:</th></table> <table bgcolor="#99ff66"><th><xsl:value-of select="@Value"/></th></table> <tr> <xsl:for-each select="*/*[name()='InspPrgInformation']"> <table bgcolor="#33ccff"><th>Inspection Program ID:</th></table> <table bgcolor="#33ccff"><th><xsl:value-of select="@Value"/></th></table> <table bgcolor="#33ccff"><th><xsl:value-of select="@NoOfTracefields"/></th></table> </xsl:for-each> </tr> </xsl:for-each>
The second for each of them is in no way connected with the first. The same thing happens with your third for everyone.
Not current() will not give you the current iteration node.
You can rewrite your first two for each of them as follows:
<tr> <xsl:for-each select="*[name()='PartInformation']"> <tr> <xsl:for-each select="current()/*/InspPrgInformation"> <table bgcolor="#33ccff"> <th>Inspection Program ID:</th> </table> <table bgcolor="#33ccff"> <th> <xsl:value-of select="@Value"/> </th> </table> <table bgcolor="#33ccff"> <th> <xsl:value-of select="@NoOfTracefields"/> </th> </table> </xsl:for-each> </tr> </xsl:for-each> </tr>
A third can be used with your current design. Since current() is local to each for each, therefore your third for each has no idea of ββthe other two. Also, your design seems to use xslt as a programming language that is not suitable.
Finally, try providing some completed / compiled examples next time, as well as your target document.
source share