Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 24th, 2010, 04:19 AM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display multiple tables using XSLT

Dear All,
I have a dataset with more than 1 data table. All data table will have
more than 1 rows. My requirement is to display all data tables in HTML format. So I tried a generic xslt.
Below is my XSLT code which displays headers for each row, instead of displaying headers for each table.
I am using dotnet 2.0. And XSLT Version 1.0. I need HTML output.
Please help to fix this!

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
 
Old March 24th, 2010, 05:54 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

Post the output xml you need from your input xml
__________________
Rummy
 
Old March 24th, 2010, 05:59 AM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I need HTML tables as output.
 
Old March 24th, 2010, 06:06 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

I did not ask yo about the output format. I asked you about the actual html output you need, like the one below:
Code:
<HTML>
   <BODY>
      <Table border="1">
         <tr>
            <td>SysID</td>
            <td>WFDocID</td>
         </tr>
         <TD>-2008080800041</TD>
         <TD>0</TD>
      </Table>
   </BODY>
</HTML>
...
I know the above html is not what you want, so post the actual html output you require.
__________________
Rummy
 
Old March 24th, 2010, 06:53 AM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The HTML output should be like....
<HTML><BODY>
<Table>
<TR><TD>
<Table border="1">
<tr><td>SysID</td><td>WFDocID</td></tr>
<tr><td>-2008080800041</td><td>0</td></tr>
</Table>
</TD></TR>
<TR><TD>&nbsp;</TD></TR>
<TR><TD>
<Table border="1">
<tr><td>SysID</td><td>ParentSysID</td></tr>
<tr><td>-2008080800045</td><td>-2008080800041</td></tr>
<tr><td>-2008080800046</td><td>-2008080800041</td></tr>
</Table>
</TD></TR>
</Table>
</Body>
</HTML>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Xslt and wml tables display arunagottimukkala XSLT 4 October 24th, 2007 03:39 AM
Importing Multiple files in Multiple tables Versi Suomi Access 6 June 1st, 2005 08:47 AM
Multiple Tables Display in XSL bmagadi XSLT 1 February 8th, 2005 03:06 PM
Multiple Recordsets from Multiple Tables TSEROOGY Classic ASP Databases 2 December 28th, 2004 12:45 PM
Display results from multiple tables Librarian Classic ASP Databases 6 July 6th, 2004 11:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.