|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: following-sibling or grouping maybe
At 2002-05-08 12:53 +0300, Matts Isuls wrote:
I dont want to add any more cells to the HTML rows if the current cell's <data> and <comment> You were not handling the current cell in your initial attempt. or the following cells on the same row are empty. You were trying here, but you didn't consider white space. the XSL below produces this: You were very close. All I did from your version was consider the normalized value of the sibling and include a test for the current node. Normalization removes leading and trailing white space and collapses consecutive sequences of white space to a single space. This allows one to test for "no content" when white space isn't significant. Otherwise, white space is significant without stylesheet commands to prune the source tree. I hope this helps. ................ Ken
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>saxon -o matts.out matts.xml matts.xsl T:\ftemp>type matts.out
<html>
<table border="1">
<tr>
<td>1
aa
bb </td>
</tr>
<tr>
<td>1
aa
</td>
<td>3 </td>
<td>4
dd
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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








