Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Intersecting Nodeset

Reply
Thread Tools

Intersecting Nodeset

 
 
Xeon
Guest
Posts: n/a
 
      07-21-2003
Hi,

I got a XML data node like this :

<item firstkey="01" secondkey="02"/>

I setup 2 lookup tables by :

<xsl:key name="key1" match="item" use="@firstkey"/>
<xsl:key name="key2" match="item" use="@secondkey"/>

Now, I need to extract nodes with specific @firstkey & @seconkey. So
how do I do this intersecting nodes extraction? or do I have to
concede to using :

key('key1', $somekey)[@secondkey = $someotherkey]

Any help appreciated
TIA
 
Reply With Quote
 
 
 
 
Dimitre Novatchev
Guest
Posts: n/a
 
      07-21-2003
Solution 1:
Define the following:

<xsl:key name="k1-2" match="item" use="concat(@firstkey, '|',
@secondkey)"/>

Then all "item" elements that have specific values for their "firstkey" and
"secondkey" attributes will be selected by:

key('k1-2', concat($somekey, '|', $someotherkey))


Solution2:

key('key1', $somekey)
[count(. | key('key2', $someotherkey))
=
count(key('key2', $someotherkey))
]


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL



"Xeon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> Hi,
>
> I got a XML data node like this :
>
> <item firstkey="01" secondkey="02"/>
>
> I setup 2 lookup tables by :
>
> <xsl:key name="key1" match="item" use="@firstkey"/>
> <xsl:key name="key2" match="item" use="@secondkey"/>
>
> Now, I need to extract nodes with specific @firstkey & @seconkey. So
> how do I do this intersecting nodes extraction? or do I have to
> concede to using :
>
> key('key1', $somekey)[@secondkey = $someotherkey]
>
> Any help appreciated
> TIA



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Area of self intersecting polygon RajkiranPro C++ 2 12-15-2007 06:33 PM
Strange problem intersecting java.awt.Polygon 418928@cepsz.unizar.es Java 4 11-13-2007 12:11 AM
Ways to tell if two XPath expressions have intersecting results Weston XML 8 10-22-2007 07:50 AM
Nodeset Difference AKA Nodeset Reduction Bryan Galvin XML 2 09-29-2004 12:09 PM
PRETTY PLEASE...need answer to why "this method should result in NodeSet" error KathyB ASP .Net 0 07-25-2003 04:59 AM



Advertisments