xsl-list
[Top] [All Lists]

Re: Creating Columnar Table format with XML data

2005-08-14 07:20:32
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[(_at_)ID='1'] | descendant::bullet[(_at_)ID='3']" />
         </xsl:call-template>
         <xsl:call-template name="printRows">
           <xsl:with-param name="list" select="descendant::bullet[(_at_)ID='2'] 
|
descendant::bullet[(_at_)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

--~------------------------------------------------------------------
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>