Re: [xsl] Re: Re: Sorting and Merge ---

Subject: Re: [xsl] Re: Re: Sorting and Merge ---
From: Dongling Ding <dling61@xxxxxxxxx>
Date: Wed, 19 Nov 2003 10:58:48 -0800 (PST)
Hi,

I figured it out this one and here it is:

<xsl:if test="/*/results/descendant::Member[@name =
$Parent]/child::Member[@name = current()/@name]">

Dongling


--- Dongling Ding <dling61@xxxxxxxxx> wrote:
> Dimitre, you are a big helper!
> 
> Here I have one more problem. Maybe you have a
> solution for me.
> 
> In the following test code. If I want not only to
> search the member name under //results, but also to
> check if the name of matched member's parent is same
> as the one I passed as prameter.
> 
> So, in the test statment, I need to do logic AND for
> those two conditions. Can I do that?
> 
> If I iterate the result of first critera, and check
> the parent of each node, I switch the context to the
> //results. Then, I have a problem of copying members
> under /doc.
> 
> Please help
> 
> 
> Dongling
> 
> 
> 
> --------------------------------------------------
> 
> <xsl:template match="Member[ancestor::doc]">
>     <xsl:if test="/*/results/descendant::Member
>                             [@name =
> current()/@name]">
>       <xsl:copy>
>         <xsl:copy-of select="@*"/>
>         <xsl:apply-templates/>
>       </xsl:copy>
>     </xsl:if>
>   </xsl:template>
> </xsl:stylesheet>
> 
> When the above transformation is performed on this
> source.xml (the 
> original
> xml document appended with the search results):
> 
> <search>
>   <doc>
>     <MemberList>
>       <Member name="P1">
>         <Member name="P11">
>           <Member name="P111"/>
>         </Member>
>         <Member name="P12">
>           <Member name="P121"/>
>         </Member>
>       </Member>
>       <Member name="P2">
>         <Member name="P21"/>
>         <Member name="P22"/>
>       </Member>
>     </MemberList>
>   </doc>
>   <results>
>     <MemberList>
>       <Member name="P1">
>         <Member name="P12">
>           <Member name="P121"/>
>         </Member>
>       </Member>
>       <Member name="P2">
>         <Member name="P21"/>
>         <Member name="P22"/>
>       </Member>
>       <Member name="P1">
>         <Member name="P11"/>
>         <Member name="P12"/>
>       </Member>
>     </MemberList>
>   </results>
> </search>
> 
> 
> 
> 
> --- Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > 
> > "Dongling Ding" <dling61@xxxxxxxxx> wrote in
> message
> >
>
news:20031118183537.2800.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxx
> > > Thanks for this new approach. We tried it and it
> > is
> > > easier than we thought.
> > >
> > > Dongling
> > 
> > Glad to help.
> > 
> > The lesson learned:
> > =============
> > If you described your problem at the very start as
> > you did in your last
> > message, you'd have saved two weeks. But instead
> you
> > were asking for some
> > details in what you believed must be the solution
> > (merging of the results
> > and discarding duplicates).
> > 
> > So, these points are important:
> > 
> >   1. It is good to start by describing the problem
> > which is being solved -- 
> > not only the problem within the solution.
> > 
> >   2. A detailed description and providing a
> complete
> > example is crucial for
> > getting help.
> > 
> >   3. If a solution is too complicated it rarely is
> > the best one.
> > 
> > 
> > =====
> > Cheers,
> > 
> > Dimitre Novatchev.
> > http://fxsl.sourceforge.net/ -- the home of FXSL
> > 
> > 
> > 
> > 
> >  XSL-List info and archive: 
> > http://www.mulberrytech.com/xsl/xsl-list
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

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


Current Thread