-
Converting XML data into a HTML Table.
If the Structure of my xml data is like this one below , how do i display
it in HTML table.
<books>
<book>
<title></title>
<isbn></isbn>
<authors>
<author_name>....</author_name>
<author_name>....</author_name>
<author_name>....</author_name>
</authors>
<description></description>
<price></price>
<book>
<book>
<title></title>
<isbn></isbn>
<authors>
<author_name>....</author_name>
<author_name>....</author_name>
<author_name>....</author_name>
</authors>
<description></description>
<price></price>
<book>
</books>
-
Re: Converting XML data into a HTML Table.
Hi Sharmila,
well you have to write one xsl file,
which generates html table as output.
In that table you have to split the cells of the column author as it again
further shows author names,
here is the sample xsl file which generates simple table,
<?xml version="1.0" encoding="UTF-8"?>
<HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<BODY>
<table width="100%" border="1">
<tr>
<th bgcolor="#ABCDEF">
EMPNO
</th>
<th bgcolor="#ABCDEF">
ENAME
</th>
<th bgcolor="#ABCDEF">
JOB
</th>
<th bgcolor="#ABCDEF">
MGR
</th>
<th bgcolor="#ABCDEF">
HIREDATE
</th>
<th bgcolor="#ABCDEF">
SAL
</th>
<th bgcolor="#ABCDEF">
COMM
</th>
<th bgcolor="#ABCDEF">
DEPTNO
</th>
<th bgcolor="#ABCDEF">
TEMP
</th>
</tr>
<xsl:for-each select="ROWSET/ROW">
<tr>
<td>
<xsl:value-of select="EMPNO"></xsl:value-of>
</td>
<td>
<xsl:value-of select="ENAME"></xsl:value-of>
</td>
<td>
<xsl:value-of select="JOB"></xsl:value-of>
</td>
<td>
<xsl:value-of select="MGR"></xsl:value-of>
</td>
<td>
<xsl:value-of select="HIREDATE"></xsl:value-of>
</td>
<td>
<xsl:value-of select="SAL"></xsl:value-of>
</td>
<td>
<xsl:value-of select="COMM"></xsl:value-of>
</td>
<td>
<xsl:value-of select="DEPTNO"></xsl:value-of>
</td>
<td>
<xsl:value-of select="TEMP"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
</BODY>
</HTML>
Have a nice time,
Jigesh.
"sharmila" <sharmila_banu@hotmail.com> wrote:
>
>If the Structure of my xml data is like this one below , how do i display
>it in HTML table.
>
><books>
> <book>
> <title></title>
> <isbn></isbn>
> <authors>
> <author_name>....</author_name>
> <author_name>....</author_name>
> <author_name>....</author_name>
> </authors>
> <description></description>
> <price></price>
> <book>
>
> <book>
> <title></title>
> <isbn></isbn>
> <authors>
> <author_name>....</author_name>
> <author_name>....</author_name>
> <author_name>....</author_name>
> </authors>
> <description></description>
> <price></price>
> <book>
></books>
>
>
-
Re: Converting XML data into a HTML Table.
If you are not familiar with HTML, try using Front Page, Create a new page
in Front Page, go to HTML tab, u'll see the necessary HTML, place this under
<BODY> tag and put </BODY> at end, before </HTML>, although u can use any
HTML editor, till you are more familiar with HTML.
"sharmila" <sharmila_banu@hotmail.com> wrote:
>
>If the Structure of my xml data is like this one below , how do i display
>it in HTML table.
>
><books>
> <book>
> <title></title>
> <isbn></isbn>
> <authors>
> <author_name>....</author_name>
> <author_name>....</author_name>
> <author_name>....</author_name>
> </authors>
> <description></description>
> <price></price>
> <book>
>
> <book>
> <title></title>
> <isbn></isbn>
> <authors>
> <author_name>....</author_name>
> <author_name>....</author_name>
> <author_name>....</author_name>
> </authors>
> <description></description>
> <price></price>
> <book>
></books>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks