<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="sqlitecrosstab.xsl"?>
<!--
GUID: sqlite-manager@sqlite-manager.googlecode.com
Homepage: http://sqlite-manager.googlecode.com

Generation Time: Tue, 22 Feb 2011 04:01:50 GMT
SQLite version: 3.7.1
-->


<!-- Database: demonstration.db -->
<demonstration.db>
<market_list>
<corp_name type="3">Mad Method Inc</corp_name>
<stock_symbol type="3">mmod</stock_symbol>
<share_volume type="1">120039</share_volume>
<share_price type="2">1.20</share_price>
</market_list>
<market_list>
<corp_name type="3">Monster Widget Inc.</corp_name>
<stock_symbol type="3">widg</stock_symbol>
<share_volume type="1">24550</share_volume>
<share_price type="2">0.56</share_price>
</market_list>
<market_list>
<corp_name type="3">Fictional Product Inc.</corp_name>
<stock_symbol type="3">ficp</stock_symbol>
<share_volume type="1">585241</share_volume>
<share_price type="2">0.27</share_price>
</market_list>
</demonstration.db>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--sqlitecrosstab.xsl
Generic XSL Transform file for SQLite Manager generated XML file.
Author : Colin Riley February 2011
http://sqlite.awardspace.info/
-->


<xsl:template match="/"> <!--Match XML document root -->
<HTML>
<BODY>
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>

<xsl:template match="/*">
<TABLE BORDER="1" CELLPADDING="3" >

<!--First row of table Column headings -->
<TR>
<!-- Loop for column headings. -->
<xsl:for-each select="*[position() = 1]/*"> <!-- Match each record element tag. -->
<TH> <xsl:value-of select="local-name()"/> <!-- Take element name as column heading -->
</TH>
</xsl:for-each> <!--End column heading loop -->
</TR>
<xsl:apply-templates/> <!--Insert remaining rows of table -->

</TABLE>
</xsl:template>

<xsl:template match="/*/*" >

<!--Loop for each field after the first field within the record or row -->
<xsl:for-each select="*[position()=1]">
<TR>
<!--Display first field as row heading -->
<TH> <xsl:value-of select="text()[position()]" /> </TH>

<!--Loop for each field after the first field within the record or row -->

<xsl:for-each select="following-sibling::*" > <!--Select next field element -->
<TD> <xsl:value-of select="text()" /> </TD>
</xsl:for-each> <!-- End of for each field loop -->
</TR>

</xsl:for-each> <!--End of for each record loop -->
</xsl:template> <!--End of table rows template -->

</xsl:stylesheet>


Colin Riley --Updated February 2011--

Home     SQLite Site Index