Intersecting Nodeset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Xeon

    #1

    Intersecting Nodeset

    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

    #2
    Re: Intersecting Nodeset

    Solution 1:
    Define the following:

    <xsl:key name="k1-2" match="item" use="concat(@fi rstkey, '|',
    @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" <xdblade@zworg. com> wrote in message
    news:78321f06.0 307211238.f7e0c 38@posting.goog le.com...[color=blue]
    > 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[/color]


    Comment

    Working...