[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: Re: Sorting and Merge ---

Subject: Re: Re: Re: Sorting and Merge ---
From: Dongling Ding <dling61@xxxxxxxxx>
Date: Tue, 18 Nov 2003 17:49:08 -0800 (PST)
checking two conditions in xslt
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.