[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How do I skip an element?
} 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
|
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
|