xsl-list
[Top] [All Lists]

Re: [xsl] HTML Tags in XML

2006-05-04 05:12:14
Please try this

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:output method="html" />

<xsl:template match="/planets">
 <html>
   <head>
      Planets
   </head>
   <body>
     <xsl:apply-templates select="planet" />
   </body>
 </html>
</xsl:template>

<xsl:template match="planet">
 <h1><xsl:value-of select="Name" /></h1>
 <xsl:copy-of select="info/node()" />
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

On 5/4/06, Neelima Adusumilli <neelima(_dot_)adusumilli(_at_)gmail(_dot_)com> 
wrote:
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.

Thanks,
Neelima

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>