[xsl] Display more than one table in generic xslt - reg

Subject: [xsl] Display more than one table in generic xslt - reg
From: Ramesh Kumar <cnrameshkumar@xxxxxxxxx>
Date: Tue, 23 Mar 2010 20:03:24 +0400
Dear All,

I need help for an issue regarding XSLT.

I have a dataset with more than 1 data table. All data table will have
more than 1 rows.

So my XSLT requirement is to show all the datatables with all rows
displayed along with headers.

Every time the tables will different. So I want a generic xslt which
supports all tables.

I tried the XSLT below but all rows are displaying with headers
instead of a table having the headers.

Please help !

My XML data is
<?xml version="1.0" standalone="yes"?>
<Sales>
  <DocHead>
    <SysID>-2008080800041</SysID>
    <WFDocID>0</WFDocID>
</DocHead>
<Line>
    <SysID>-2008080800045</SysID>
    <ParentSysID>-2008080800041</ParentSysID>
    <DocType>51</DocType>
</Line>

<Line>
    <SysID>-2008080800046</SysID>
    <ParentSysID>-2008080800041</ParentSysID>
    <DocType>51</DocType>
</Line>
</Sales>

Attempted XSL code is below.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="html"/>
 <xsl:template match="/">
  <HTML>
   <BODY>
    <xsl:for-each select="*/*">
     <xsl:variable name="PrevRow" select="name(.)"/>
     <Table border="1">
      <tr>
       <xsl:for-each select="*">
        <td>
         <xsl:value-of select="local-name()"/>
        </td>
       </xsl:for-each>
      </tr>
      <xsl:apply-templates/>

     </Table>
    </xsl:for-each>
   </BODY>
  </HTML>
 </xsl:template>
 <xsl:template match="/*/*">
  <xsl:param name="nodeset"/>
  <TR>
   <xsl:apply-templates />
  </TR>
 </xsl:template>
 <xsl:template match="/*/*/*">
  <TD>
   <xsl:value-of select="."/>
  </TD>
 </xsl:template>
</xsl:stylesheet>



Regards,
Ramesh

Current Thread