RE: problems with copying duplicate nodes
> I read quite a few of the earlier posts on this topic > and tried to work out a solution but it aint working. > Snippets of my code are shown below: > > input.xml > > <TABLE> > <TR> > <TD>Checking existence of Wood</TD> > <TR> > <TD>Found values for Wood</TD> > <TD> The values are x y z</TD> > <TD>Found values for Wood</TD> > <TD> The values are x y z</TD> > </TR> > </TR> > <TR> > <TD>Checking existence of Tree</TD> > <TR> > <TD>Found values for Tree</TD> > <TD> The values are a b c</TD> > </TR> > </TR> > </TABLE> Is that legal HTML? > I want to eliminate the duplicate <TD>s inside TABLE > /TR/TR whenever they occur. I tried two solutions but > none of them eliminate the duplicate entries. You basically want to key on the value of the <TD> and then only process those <TD>'s that occur first in the key eg: <xsl:key name="tds" match="TD" use="."/> and then: <xsl:template match="TD"> <xsl:if test="generate-id() = generate-id(key('tds',.))"> ... Check out David Pawson's FAQ: http://www.dpawson.co.uk/xsl/sect2/N2696.html cheers andrew
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