This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Re: Ignore Tags
- From: "vasu deva" <vsd18 at rediffmail dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: 26 Feb 2002 20:12:28 -0000
- Subject: Re: Re: [xsl] Ignore Tags
- Reply-to: xsl-list at lists dot mulberrytech dot com
Dear Joerg, thank you very much...
it really helped me out.
greatfuly yours
vsd
On Wed, 27 Feb 2002 Joerg Heinicke wrote :
>This is a general grouping problem.
>
>The easiest way is to test (with the preceding-sibling-axis)
>whether there
>was already a child with this id:
>
><xsl:template match="root">
> <xsl:apply-templates select="child[not(@id =
>preceding-sibling::child/@id)]"/>
></xsl:template>
>
><xsl:template match="child">
> do anything with the happy childs
></xsl:template>
>
>The second way for bigger files (the above way is not so good,
>because for
>every child all preceding childs have to be tested) is using keys
>(Muenchian
>Method,
>http://www.jenitennison.com/xslt/grouping/muenchian.html)
>
><xsl:key name="childs" match="child" use="@id"/>
>
><xsl:template match="root">
> <xsl:apply-templates select="child[count( . | key('childs',
>@id)[1]) =
>1]"/>
></xsl:template>
>
>Hope this helps,
>
>Joerg
>
> > hi
> >
> > I have a problem .. it goes like this
> > an xml file of thie folowing format
> >
> > <root>
> > <child id = '1'>happy</child>
> > <child id = '2'>happy</child>
> > <child id = '3'>happy</child>
> > <child id = '1'>sad</child>
> > <child id = '2'>sad</child>
> > <child id = '3'>sad</child>
> > </root>
> >
> > my problem is that when i go through each of the child
>elements,
> > then i should ignore the duplicates that is once child id =
>'1' is
> > encountered, the second time it should be ignored.. so
>effectively
> > the result should be
> > all happy 'childs' .. Is there a way to do that??
> > please help me
> > vsd
>
>
> XSL-List info and archive:
>http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list