|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Re: Ignore Tags
Subject: Re: Re: Ignore Tags
From: "vasu deva" <vsd18@xxxxxxxxxxxxxx>
Date: 26 Feb 2002 20:12:28 -0000
|
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

| Current Thread |
- Ignore Tags
- vasu deva - Tue, 26 Feb 2002 13:24:53 -0500 (EST)
- <Possible follow-ups>
- vasu deva - Tue, 26 Feb 2002 15:09:52 -0500 (EST) <=
|
|
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
| RSS 2.0 |
|
| Atom 0.3 |
|
|