Re: How to Display XML tags and values in an HTML page?



Thanks Peter,

I have partially solved the issue. Here is the output and the xsl Used.

Output:

List of matching Flights

Flight
Flight_Number: BA123
Origin: GLA
Destination: LHR
Carrier: British Airways
Date: 01/01/2002

Flight
Flight_Number: BA4234
Origin: GLA
Destination: YOW
Carrier: British Airways
Date: 01/01/2002

Flight
Flight_Number: AA4959
Origin: GLA
Destination: LHR
Carrier: American Airways
Date: 01/01/2002

Flight
Flight_Number: AC23
Origin: CAN
Destination: LHR
Carrier: Air Canada
Date: 01/02/2004


xsl:

<xsl:style*** version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" indent="no"/>
<xsl:template match="Flights">
<html>
<head>
<title>Matching Request Flights</title>
</head>
<body>
<h1>List of matching Flights </h1>
<xsl:apply-templates select="Flight"/>
</body>
</html>
</xsl:template>

<!-- Templates -->
<xsl:template match="Flight">
<!-- Display Flight-->
<tr><th><br/>
<b><font color="blue"><xsl:value-of select="local-name()"/></font></b>
</th></tr>
<table border="0">
<xsl:apply-templates />
</table>
</xsl:template>

<xsl:template match="Flight/*">
<tr><td><b><xsl:value-of select="local-name()"/>:</b></td>
<td><xsl:value-of select="."/></td></tr>
</xsl:template>

</xsl:style***>

.


Quantcast