XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
AK TiwariSubject: How to remove a row from table based on content (HTML)
Author: AK Tiwari
Date: 20 Dec 2006 04:45 AM
Hi,
I have an html doc like :
<table>
<tr> <td> col1 </td> </tr>
<tr> <td> col2 </td> </tr>
<tr> <td> col3 </td> </tr>
</table>

I want to delete a row that contains some specific data i.e. if col1, col2, col3 are data like AAA, BBB, CCC and I want to delete the row that contains text BB.
I am able to get to the element using xslt, but am finding it difficult to get an html that doesnt contain the whole row.

Can anyone help?


Thanks in advance.
AK

Posttop
(Deleted User) Subject: How to remove a row from table based on content (HTML)
Author: (Deleted User)
Date: 31 Dec 2006 09:57 AM
Hi AK,
you need to create a stylesheet that copies all the data, excluding the <tr> node that matches the column you need to remove; you can start with something like this

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="tr[td = 'col2']">
</xsl:template>

<xsl:template match="*">
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="*|text()"/>
</xsl:element>
</xsl:template>

</xsl:stylesheet>

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.