Subject: Re: [xsl] HTML Tags in XML From: "andrew welch" <andrew.j.welch@xxxxxxxxx> Date: Thu, 4 May 2006 13:13:48 +0100 |
Hi all, I have an XML file as follows:
<?xml version="1.0"?> <planets> <planet> <Name>Mercury</Name> <info> <table> <tr> <td>Smallest Planet</td> <td>Closest to Sun</td> </tr> </table> </info> </planet>
<planet> <Name>Earth</Name> <info> This is the planet we all live on </info> </planet> </planets>
There is no particular pattern in info field. But whatever is given as the value of info, will be in html.
Is there a way to use XSL and generate the following html code...
<html> <head> Planets </head> <body> <h1>Mercury</h1> <table> <tr> <td>Smallest Planet</td> <td>Closest to Sun</td> </tr> </table> <h1>Earth</h1> This is the planet we all live on </body> </html>
Can some body help me with this? I need to get the content/value of <info> as it is (even though it is html) and put it in the resultant html file using XSL.
This looks like a school project... If so well done for using a mailing list :)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Planets</title> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template>
<xsl:template match="Name"> <h1><xsl:value-of select="."/></h1> </xsl:template>
<xsl:template match="info"> <xsl:copy-of select="."/> </xsl:template>
cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] HTML Tags in XML, Mukul Gandhi | Thread | Re: [xsl] HTML Tags in XML, Mukul Gandhi |
Re: [xsl] HTML Tags in XML, omprakash . v | Date | Re: [xsl] XSL-FO alignment, omprakash . v |
Month |