Hi,
I have the following XML and .xslt files.
I'm trying to execute a nested for-each loop. First, I need to iterate on the "modules" nodes, and then iterate on the "data" nodes in each module. The problem is, the for-each for the "data" works, but the for-each for the"modules" doesn't.
What am I missing?
Thanks.
Here is the .xslt
<xsl:template match="GModules"><xsl:value-of select="@text"/><xsl:for-each select="/modules"><table><xsl:for-each select="*/data"><tr><td><xsl:value-of select="label"/></td><td><xsl:value-of select="value"/></td></tr></xsl:for-each></table></xsl:for-each></xsl:template>
Here is the XML:
<GModules text="Modules"><modules text="Device"><data><label>ID</label><value>1</value></data><data><label>SN</label><value>0</value></data><data><label>SW</label><value>1</value></data><data><label>HW</label><value>E</value></data></modules><modules text="Sensor"><data><label>ID</label><value>2</value></data><data><label>SN</label><value>1</value></data><data><label>SW</label><value></value></data><data><label>HW</label><value></value></data></modules><modules text="Connector"><data><label>ID</label><value>3</value></data><data><label>SN</label><value>9</value></data><data><label>SW</label><value></value></data><data><label>HW</label><value></value></data></modules>
</GModules>