Subject: Re: [xsl] following-sibling or grouping maybe From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Wed, 08 May 2002 08:59:57 -0400 |
I dont want to add any more cells to the HTML rows if the current cell's <data> and <comment>
or the following cells on the same row are empty.
the XSL below produces this:
1 aa 2 bb 3 4 1 aa 2 3 4 dd
but i would like it this way:
1 aa 2 bb 1 aa 2 3 4 dd
T:\ftemp>type matts.xml <?xml version="1.0"?> <table> <row> <cell id="1"> <data>aa</data> <comment></comment> </cell> <cell id="2"> <data></data> <comment>bb</comment> </cell> <cell id="3"> <data></data> <comment></comment> </cell> <cell id="4"> <data></data> <comment></comment> </cell> <cell id="5"> <data></data> <comment></comment> </cell> </row> <row> <cell id="1"> <data>aa</data> <comment></comment> </cell> <cell id="2"> <data></data> <comment></comment> </cell> <cell id="3"> <data></data> <comment></comment> </cell> <cell id="4"> <data>dd</data> <comment></comment> </cell> <cell id="5"> <data></data> <comment></comment> </cell> </row> </table>
T:\ftemp>type matts.xsl <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <table border="1"> <xsl:for-each select="/table/row"> <tr> <xsl:for-each select="cell"> <xsl:if test="normalize-space(.)!='' or following-sibling::*[normalize-space(.)!='']"> <td> <xsl:value-of select="@id"/><xsl:value-of select="."/> </td> </xsl:if> </xsl:for-each> </tr> </xsl:for-each> </table> </html> </xsl:template> </xsl:stylesheet>
T:\ftemp>type matts.out <html> <table border="1"> <tr> <td>1 aa
</td> <td>2
</td> </tr> <tr> <td>1 aa
</td> <td>2
</td> <td>3
</td> <td>4 dd
</td> </tr> </table> </html> T:\ftemp>rem Done!
-- Upcoming: 3-days XSLT/XPath and/or 2-days XSLFO: June 17-21, 2002 - : 3-days XML Information Modeling: July 31-August 2, 2002
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-07-1 Practical Formatting Using XSLFO XSL/XML/DSSSL/SGML/OmniMark services, books(electronic, printed), articles, training(instructor-live,Internet-live,web/CD,licensed) Next public training: 2002-05-06,07,09,10,13,15,20, - 06-04,07,10,11,13,14,17,20,07-31,08-05,27,30
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] following-sibling or grouping, Matts Isuls | Thread | Re: [xsl] following-sibling or grou, Steve Rosenberry |
RE: [xsl] Output XML doc with XSL d, Michael Kay | Date | Re: [xsl] question about javascript, Oleg Tkachenko |
Month |