Hi Everyone,
I am new to XML and XSLT and I am learing them.
If for a particular column we have sub rows then how can we get to show them in an html page
For example, consider these four columns..
name age gender children
in my xml i have tags as
<Family>
<name>Suresh</name>
<age>30</age>
<gender>Male</gender>
<children>
<name> Sruthi</name>
<age> 8</age>
<gender> Female</gender>
</children>
<children>
<name>Sraavya</name>
<age>4 </age>
<gender> Female</gender>
</children>
<children>
<name>Sravanthi</name>
<age>2 </age>
<gender>Female </gender>
</children>
</Family>
<Family>
<name>Nitin</name>
<age>38</age>
<gender>Male</gender>
<children>
<name> Shanthi</name>
<age> 15</age>
<gender> Female</gender>
</children>
<children>
<name>Sheetal</name>
<age>12 </age>
<gender> Female</gender>
</children>
<children>
<name>Vidya</name>
<age>9</age>
<gender>Female </gender>
</children>
<children>
<name>kaavya</name>
<age>6 </age>
<gender> Female</gender>
</children>
<children>
<name>Neeta</name>
<age>3</age>
<gender>Female </gender>
</children>
</Family>
The output in the html file after formatting in the xsl file Should be as
name age gender children
Suresh 30 Male Sruthi
Sraavya
Sravanthi
Nitin 38 Male shanthi
sheetal
vidya
kaavya
Neeta
Please note that the children names appear one after the other in the next line below the children column
And my xsl file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="<xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="details/family">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="age"/></td>
<td><xsl:value-of select="gender"/></td>
<xsl:for-each select="children">
<td><xsl:value-of select="name"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
When i am doing it, i am getting the output as,
name age gender children
Suresh 30 Male sruthi sraavya Sravanthi
Nitin 38 Male shanthi sheetal vidya kaavya Neeta
Here i am getting the children names in the same line.
Can anyone Pl explain how to get the desired output
Thanks in Advance.
I am new to XML and XSLT and I am learing them.
If for a particular column we have sub rows then how can we get to show them in an html page
For example, consider these four columns..
name age gender children
in my xml i have tags as
<Family>
<name>Suresh</name>
<age>30</age>
<gender>Male</gender>
<children>
<name> Sruthi</name>
<age> 8</age>
<gender> Female</gender>
</children>
<children>
<name>Sraavya</name>
<age>4 </age>
<gender> Female</gender>
</children>
<children>
<name>Sravanthi</name>
<age>2 </age>
<gender>Female </gender>
</children>
</Family>
<Family>
<name>Nitin</name>
<age>38</age>
<gender>Male</gender>
<children>
<name> Shanthi</name>
<age> 15</age>
<gender> Female</gender>
</children>
<children>
<name>Sheetal</name>
<age>12 </age>
<gender> Female</gender>
</children>
<children>
<name>Vidya</name>
<age>9</age>
<gender>Female </gender>
</children>
<children>
<name>kaavya</name>
<age>6 </age>
<gender> Female</gender>
</children>
<children>
<name>Neeta</name>
<age>3</age>
<gender>Female </gender>
</children>
</Family>
The output in the html file after formatting in the xsl file Should be as
name age gender children
Suresh 30 Male Sruthi
Sraavya
Sravanthi
Nitin 38 Male shanthi
sheetal
vidya
kaavya
Neeta
Please note that the children names appear one after the other in the next line below the children column
And my xsl file is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="<xsl:template match="/">
<html>
<body>
<table>
<xsl:for-each select="details/family">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="age"/></td>
<td><xsl:value-of select="gender"/></td>
<xsl:for-each select="children">
<td><xsl:value-of select="name"/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
When i am doing it, i am getting the output as,
name age gender children
Suresh 30 Male sruthi sraavya Sravanthi
Nitin 38 Male shanthi sheetal vidya kaavya Neeta
Here i am getting the children names in the same line.
Can anyone Pl explain how to get the desired output
Thanks in Advance.