[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Create Table

Subject: Re: Create Table
From: "Eric J. Bowman" <eric@xxxxxxxxxxxxxxxx>
Date: Mon, 22 Mar 2010 23:21:57 -0600
Re:  Create Table
My solution assumes @field='file' is a mandatory field, i.e. won't be
missing.  The gist of it is, the number of @field='file' <data> elements
above a given <data section='changes'> must equal the position() of the
//data[@field='file'] that triggered the xsl:apply-templates.

-Eric

<?xml version='1.0' encoding='utf-8'?>
<server-manifest>
    <category-source>
        <interface-categories>
            <data section='diff'>if (reportService != null)</data>
            <data section='diff'>return true;</data>
            <data section='diff'>return false;</data>
            <data section='changes' field='file'>ConvertHistoryWages.java</data>
            <data section='changes' field='version'>\main\spr2010_apr_dev\2</data>
            <data section='changes' field='date'>20100310.102844</data>
            <data section='changes' field='user'>jryan</data>
            <data section='changes' field='cr_number'>602018</data>
            <data section='changes' field='comment'>fix for log 5960</data>
            <data section='diff'>1296a1297,1298</data>
            <data section='diff'></data>
            <data section='diff'>if (reportService != null)</data>
            <data section='diff'>return true;</data>
            <data section='diff'>return false;</data>
            <data section='changes' field='file'>HistoryWages.java</data>
            <data section='changes' field='version'>\main\spr2009_apr_dev\2</data>
            <data section='changes' field='date'>20090310.102844</data>
            <data section='changes' field='cr_number'>602118</data>
            <data section='changes' field='comment'>fix for log 6950</data>
            <data section='diff'>1296a1297,1298</data>
            <data section='diff'></data>
            <data section='diff'>if (reportService != null)</data>
            <data section='diff'>return true;</data>
            <data section='diff'>return false;</data>
            <data section='changes' field='file'>Wages.java</data>
            <data section='changes' field='date'>20080310.102844</data>
            <data section='changes' field='user'>ryanj</data>
            <data section='changes' field='cr_number'>602218</data>
            <data section='diff'>1296a1297,1298</data>
            <data section='diff'></data>
        </interface-categories>
    </category-source>
</server-manifest>

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0'
    xmlns='http://www.w3.org/1999/xhtml'
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
    <xsl:output omit-xml-declaration='no' method='xml' indent='yes' xml:space='default' encoding='utf-8'/>
    <xsl:template match='/'>
        <html xml:lang='en'>
            <head>
                <title>table example</title>
                <style type='text/css'>table{table-layout:fixed;width:auto}</style>
            </head>
            <body>
                <table width='0' summary='summary goes here for accessibility'>
                    <caption>caption goes here for accessibility</caption>
                    <thead>
                        <tr>
                            <td>&#160;</td>
                            <th>Version</th>
                            <th>Date</th>
                            <th>User</th>
                            <th>CR Number</th>
                            <th>Comment</th>
                        </tr>
                    </thead>
                    <tfoot><!-- optional -->
                        <tr>
                            <td>&#160;</td>
                            <th>Version</th>
                            <th>Date</th>
                            <th>User</th>
                            <th>CR Number</th>
                            <th>Comment</th>
                        </tr>
                    </tfoot>
                    <tbody><xsl:apply-templates select="//data[@field='file']"/></tbody>
                </table>
            </body>
        </html>
    </xsl:template>
    <xsl:template match='data'>
        <xsl:param name='i' select='position()'/>
        <tr>
            <th><xsl:value-of select='.'/></th>
            <td><xsl:value-of select="following-sibling::data[@field='version' and count(preceding-sibling::data[@field='file'])=$i]"/>&#160;</td>
            <td><xsl:value-of select="following-sibling::data[@field='date' and count(preceding-sibling::data[@field='file'])=$i]"/>&#160;</td>
            <td><xsl:value-of select="following-sibling::data[@field='user' and count(preceding-sibling::data[@field='file'])=$i]"/>&#160;</td>
            <td><xsl:value-of select="following-sibling::data[@field='cr_number' and count(preceding-sibling::data[@field='file'])=$i]"/>&#160;</td>
            <td><xsl:value-of select="following-sibling::data[@field='comment' and count(preceding-sibling::data[@field='file'])=$i]"/>&#160;</td>
        </tr>
    </xsl:template>
</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.