xsl-list
[Top] [All Lists]

RE: Problems selecting the right nodes.

2003-09-25 15:51:01
But this is an O(n^2) solution and doesn't remove the duplicates...

Michael Kay

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Kienle, Steven C [PGRD/0200]
Sent: 25 September 2003 18:01
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: RE: [xsl] Problems selecting the right nodes. 



I'm not sure if this will fit the bill, but it does return 
the correct results with your sample below.

<xsl:template match="service">
    <xsl:if test="/root/branch[not(service/@id = current()/@id)]">
        <xsl:value-of select="@id" />
    </xsl:if>
</xsl:template>

Basically, this matches the service nodes and only executes 
the value-of when the exists a branch which does not have a 
service with the same @id as the current service.  Because it 
is processing nodes, it possible that you could have some 
duplication, which you may not want.  You might be able to 
use this as a starting point.

      Steve

-----Original Message-----
From: Adam van den Hoven [mailto:list(_at_)adamvandenhoven(_dot_)com]

I have a nodeset or arbitrary length that contains a set of 
tags which 
look something like:

<branch id="br1">
   <service id="service1" />
   <service id="service2" />
   <service id="service3" />
</branch>
<branch id="br2">
    <service id="service1" />
    <service id="service4" />
</branch>

Now what I want is a nodeset that contains (uniquely) all the 
services 
that do not occur in all the branches. In this case I want 
service 2, 3 
and 4 but not 1


This communication is intended solely for the use of the 
addressee and may contain information that is legally 
privileged, confidential or exempt from disclosure.  If you 
are not the intended recipient, please note that any 
dissemination, distribution, or copying of this communication 
is strictly 
prohibited.  Anyone who receives this message in error should 
notify the 
sender immediately and delete it from his or her computer.


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



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



<Prev in Thread] Current Thread [Next in Thread>