| Subject: RE: [xsl] problems with copying duplicate nodes From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx> Date: Wed, 29 Jun 2005 10:49:36 +0100 | 
> 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',.)[1])">
     ...
Check out David Pawson's FAQ:
http://www.dpawson.co.uk/xsl/sect2/N2696.html
cheers
andrew
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] problems with copying dup, David Carlisle | Thread | [xsl] Controlling the flow of a pro, Fadi Qutaishat | 
| Re: [xsl] test if null, David Carlisle | Date | Re: [xsl] problems with copying dup, Mukul Gandhi | 
| Month |