| | |
Displayind data in XML file using HTML
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2006
Posts: 2
Reputation:
Solved Threads: 0
Hi Gody,
You can use XSLT to format the pages like the way you want
Refer to http://www.w3schools.com/xsl/default.asp and find the formatting.
Remember to include the reference to your XSLT file you created in the xml
The sample xslt file will be like this...........
<?xmlversion="1.0"encoding="iso-8859-1"?>
<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:templatematch="/">
<html>
<body>
<h2>My page</h2>
<tableborder="1">
<trbgcolor="#9acd32">
<th>Date</th>
<th>Purpose</th>
</tr>
<xsl:for-eachselect="SalesVisit/Details">
<tr>
<td>
<xsl:value-ofselect="Date"/>
</td>
<td>
<xsl:value-ofselect="Purpose"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
MY Raw xml file before formatting was like this...
<?xmlversion="1.0"encoding="UTF-8"?>
<?xml-stylesheettype="text/xsl" href="XSLTFile.xsl"?>
<SalesVisit>
<Details>
<Date>1/1/2006</Date>
<Purpose>Sales Visist 1</Purpose>
</Details>
<Details>
<Date>2/1/2006</Date>
<Purpose>Sales Visist 2</Purpose>
</Details>
<Details>
<Date>3/1/2006</Date>
<Purpose>Sales Visist 3</Purpose>
</Details>
<Details>
<Date>4/1/2006</Date>
<Purpose>Sales Visist 4</Purpose>
</Details>
</SalesVisit>
by Rajesh C Medackel, TVM, India
You can use XSLT to format the pages like the way you want
Refer to http://www.w3schools.com/xsl/default.asp and find the formatting.
Remember to include the reference to your XSLT file you created in the xml
The sample xslt file will be like this...........
<?xmlversion="1.0"encoding="iso-8859-1"?>
<xsl:stylesheetversion="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:templatematch="/">
<html>
<body>
<h2>My page</h2>
<tableborder="1">
<trbgcolor="#9acd32">
<th>Date</th>
<th>Purpose</th>
</tr>
<xsl:for-eachselect="SalesVisit/Details">
<tr>
<td>
<xsl:value-ofselect="Date"/>
</td>
<td>
<xsl:value-ofselect="Purpose"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
MY Raw xml file before formatting was like this...
<?xmlversion="1.0"encoding="UTF-8"?>
<?xml-stylesheettype="text/xsl" href="XSLTFile.xsl"?>
<SalesVisit>
<Details>
<Date>1/1/2006</Date>
<Purpose>Sales Visist 1</Purpose>
</Details>
<Details>
<Date>2/1/2006</Date>
<Purpose>Sales Visist 2</Purpose>
</Details>
<Details>
<Date>3/1/2006</Date>
<Purpose>Sales Visist 3</Purpose>
</Details>
<Details>
<Date>4/1/2006</Date>
<Purpose>Sales Visist 4</Purpose>
</Details>
</SalesVisit>
by Rajesh C Medackel, TVM, India
Last edited by inkrajesh; Jun 13th, 2006 at 3:54 am.
![]() |
Similar Threads
- Capturing data from txt file using JavaScript/HTML (JavaScript / DHTML / AJAX)
- [urgent] HTML form => XML file (JSP)
- Listview Data to XML or file (VB.NET)
- How to re-organized XML file and call XML file from my software (RSS, Web Services and SOAP)
- append to XML file (Visual Basic 4 / 5 / 6)
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: How to Parse XML file
- Next Thread: how xml is useful?
| Thread Tools | Search this Thread |
.htaccess 301 accept access alltop api authentication binarysecuritytoken blog card collaboration credit data development ebay email evernote flash google government highrise htaccess intel internet legal live netbeans patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server service soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xerces xml xslt y!os yahoo ydn





