Re: removing duplicate children

Subject: Re: removing duplicate children
From: Ian Davis <ian@xxxxxxxxxx>
Date: Tue, 5 Dec 2000 08:33:18 +0000
I don't think this made it through - apologies for the duplicate if it
did.

On Friday, December 01, 2000, 2:10:41 AM, Cliff wrote:

> I have a chunk of script that looks something like:
> <xsl:template match="call">
>   <xsl:text>void </xsl:text>
>   <xsl:apply-templates select="name"/>
>   <xsl:text>() throws </xsl:text>
>   <xsl:for-each select=".//throws">
>     <xsl:text>, </xsl:text>
>     <xsl:apply-template select="."/>
>   </xsl:for-each>
> </xsl:template>

How about

<xsl:template match="call">
  <xsl:text>void </xsl:text>
  <xsl:apply-templates select="name"/>
  <xsl:text>() throws </xsl:text>
  <xsl:for-each select=".//throws[not(parent::call/call/throws = .)]">
    <xsl:text>, </xsl:text>
    <xsl:apply-templates />
  </xsl:for-each>
</xsl:template>


The xsl:for-each means 'select any throws elements whose parent does
not have a call child with a throws element of the same value'


Ian
--
Chief Technology Officer
Calaba - Discovering Technology
Tel: +44 (0)20 7494 1851
GSM: +44 (0)77 7964 9112



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread