Hi,
I have spent a couple of hours on this. Really puzzling for newbie me. I am sure its something simple i am missing here.
Please see the attached for the full code.
But basically I am trying to create two tables.
First table - displays the data under "greeting/Item". (with a for-each loop)
Second table - displays the data under value of "nCustomerMarketing/ndata7/@value"
When i use this, it only displays the second table and the first table vanishes. When i comment out the second "<xsl:template", the first table shows up. Code is below and the XML file is attached in Here is the code.
Thanks in advance for your help
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslutput method="html"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="xml"/>
</body>
</html>
</xsl:template>
<xsl:template match="nroot">
<table border="1">
<xsl:for-each select="greeting/Item">
<tr>
<td>
<xsl:value-of select="npaymentmethod_name"/>
</td>
<td>
<xsl:value-of select="npaymentmethod_type"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
</xsl:template>
<xsl:template match="nroot">
<table border="1">
<tr>
<td>
<xsl:value-of select="nCustomerMarketing/ndata7/@value"/>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>
I have spent a couple of hours on this. Really puzzling for newbie me. I am sure its something simple i am missing here.
Please see the attached for the full code.
But basically I am trying to create two tables.
First table - displays the data under "greeting/Item". (with a for-each loop)
Second table - displays the data under value of "nCustomerMarketing/ndata7/@value"
When i use this, it only displays the second table and the first table vanishes. When i comment out the second "<xsl:template", the first table shows up. Code is below and the XML file is attached in Here is the code.
Thanks in advance for your help
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xslutput method="html"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="xml"/>
</body>
</html>
</xsl:template>
<xsl:template match="nroot">
<table border="1">
<xsl:for-each select="greeting/Item">
<tr>
<td>
<xsl:value-of select="npaymentmethod_name"/>
</td>
<td>
<xsl:value-of select="npaymentmethod_type"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
</xsl:template>
<xsl:template match="nroot">
<table border="1">
<tr>
<td>
<xsl:value-of select="nCustomerMarketing/ndata7/@value"/>
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>