[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: problems with copying duplicate nodes

Subject: RE: problems with copying duplicate nodes
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Wed, 29 Jun 2005 10:49:36 +0100
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
>     <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',.)[1])">

Check out David Pawson's FAQ:


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.