Re: [xsl] Creating Columnar Table format with XML data

Subject: Re: [xsl] Creating Columnar Table format with XML data
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sun, 14 Aug 2005 19:50:32 +0530
Please try this XSLT stylesheet -

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

<xsl:output method="html" indent="yes" />

<xsl:template match="/root">
   <html>
     <head>
       <title/>
     </head>
     <body>
       <table>
         <tr>
           <xsl:apply-templates select="column" />
         </tr>
         <xsl:call-template name="printRows">
           <xsl:with-param name="list"
select="descendant::bullet[@ID='1'] | descendant::bullet[@ID='3']" />
         </xsl:call-template>
         <xsl:call-template name="printRows">
	   <xsl:with-param name="list" select="descendant::bullet[@ID='2'] |
descendant::bullet[@ID='4']" />
         </xsl:call-template>
       </table>
     </body>
   </html>
</xsl:template>

<xsl:template match="column">
   <td>
     <xsl:value-of select="@title" />
   </td>
</xsl:template>

<xsl:template name="printRows">
   <xsl:param name="list" />

   <tr>
     <xsl:for-each select="$list">
       <xsl:if test="((count($list) = 1) and (($list/@ID = '3') or
($list/@ID = '4')))">
         <td/>
       </xsl:if>
       <td>
         <xsl:value-of select="tip" />
       </td>
       <xsl:if test="((count($list) = 1) and (($list/@ID = '1') or
($list/@ID = '2')))">
         <td/>
       </xsl:if>
     </xsl:for-each>
   </tr>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

Current Thread