Intersecting Nodeset

Discussion in 'XML' started by Xeon, Jul 21, 2003.

  1. Xeon

    Xeon Guest

    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
    Xeon, Jul 21, 2003
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
    Dimitre Novatchev, Jul 21, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KathyB
    Replies:
    0
    Views:
    568
    KathyB
    Jul 25, 2003
  2. Bryan Galvin
    Replies:
    2
    Views:
    426
    Bryan Galvin
    Sep 29, 2004
  3. Weston
    Replies:
    8
    Views:
    1,615
    Philippe Poulard
    Oct 22, 2007
  4. Replies:
    4
    Views:
    982
  5. RajkiranPro

    Area of self intersecting polygon

    RajkiranPro, Dec 15, 2007, in forum: C++
    Replies:
    2
    Views:
    874
    Jim Langston
    Dec 15, 2007
Loading...

Share This Page