Subject: Re: How do I skip an element? From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 5 May 1999 10:56:31 +0100 (BST) |
} XML } <data> } <row><column1>text1a</column1><column2>text1b</column2><column3>text3a</column3></row> } <row><column1>text2a</column1><column2>text2b</column2><column3>text3b</column3></row> } </data> } } I want } <table> } <tr> } <th>column1</th> } <th>column3</th> } </tr> } <tr> } <td>text1a</td> } <td>text1c</td> } </tr> } <tr> } <td>text2a</td> } <td>text2c</td> } </tr> } </table> Is that _really_ what you want? where is text1c supposed to come from, which isn't in the source file? I suspect that given the input <data> <row><column1>text1a</column1><column2>text1b</column2><column3>text1c</column3></row> <row><column1>text2a</column1><column2>text2b</column2><column3>text2c</column3></row> </data> you want to cut out column 2 and fabricate a header row, like so: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <table> <tr> <th>column1</th> <th>column3</th> </tr> <tr> <td>text1a</td> <td>text1c</td> </tr> <tr> <td>text2a</td> <td>text2c</td> </tr> </table> In case that is what you meant, it was generated by <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns="http://www.w3.org/TR/REC-html40" result-ns=""> <xsl:template match="data"> <table> <tr> <xsl:for-each select="row[1]/*[not(position() = 2)]"> <th><xsl:value-of select="qname(.)"/></th> </xsl:for-each> </tr> <xsl:apply-templates/> </table> </xsl:template> <xsl:template match="row"> <tr> <xsl:apply-templates/> </tr> </xsl:template> <xsl:template match="row/*[position()=2]"> </xsl:template> <xsl:template match="row/*[not(position() = 2)]"> <td> <xsl:apply-templates/> </td> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: How do I skip an element?, Sara Mitchell | Thread | RE: How do I skip an element?, Kay Michael |
Re: XFO Mapping..., Guy_Murphy | Date | RE: Can a match attribute use a non, Kay Michael |
Month |