RE: [xsl] Help culling out duplicates with preceding::

Subject: RE: [xsl] Help culling out duplicates with preceding::
From: cknell@xxxxxxxxxx
Date: Wed, 06 Oct 2004 09:32:00 -0400
If you want to constrain the XPath expression's application to the preceding siblings of "member", then use the preceeding-sibling axis.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Charlie Consumer <faceless1976@xxxxxxxxx>
Sent:     Tue, 5 Oct 2004 07:27:34 -0700 (PDT)
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] Help culling out duplicates with preceding::

Hi,

I'm trying to cull out duplicate XML by using
preceding:: axes as discussed in the FAQ.  I'm having
trouble doing so.  My XSL takes in an ID as a
parameter.  Then it selects out all the sibiling nodes
that the ID is in.  For example:

<mesh name='A'>
   <member id='1'/>
   <member id='2'/>
   <member id='3'/>
</mesh>
<mesh name='B'>
   <member id='4'/>
   <member id='5'/>
   <member id='6'/>
   <member id='1'/>
   <member id='2'/>
</mesh>

My XPATH query is something like the following:

mesh/member[not(@id=$thisId) and not(@removed) and
not( @id = preceding::member[not(@removed)]/@id )]

In the case where thisId='1' it would select the
following:   from mesh A members with 2 and 3 and from
mesh B 4, 5, and 6 which is what I expect.

But in the case where thisId='4' it would select only
4, 5, and 6.  I was expecting it would select from
mesh B 1 and 2, but the preceding:: axes culled it
out.  I understand why it did because the preceding::
axes isn't constrained to just the nodes that are 4's
siblings.  But, I'm not sure how to make it contrained
to 4's siblings.  Can someone help me with what I'm
missing?

What the query is trying to accomplish is where ever
thisId is a member of a mesh.  I want to select out
all the siblings of that mesh.  If he belongs to more
than one mesh any duplicates between the meshes (i.e.
when thisId='1' 2 is a dup).  Only give me the first
occurence of that dup.

Thanks
Charlie


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

Current Thread