Compensation of IN operator

Discussion in 'XML' started by oSup, Mar 9, 2005.

  1. oSup

    oSup Guest

    Hi, I have a question, how to solve this stupid problem:

    Let's have this source:

    <data>
    <groups>
    <group id="1">gr1</group>
    <group id="2">gr2</group>
    <group id="3">gr3</group>
    </groups>

    <articles>

    <article aid="1">
    <group id="2"/><group id="3"/>
    </article>

    <article aid="2">
    <group id="2"/><group id="3"/><group id="1"/>
    </article>

    <article aid="3">
    <group id="4"/>
    </article>

    <article aid="4">
    </article>

    </articles>
    </data>

    I'd like to select just articles, they are contained in at least one
    existing group. It means articles aid={1, 2}. How to select them? Id
    tried something like condition:

    .... i'm in /data/articles/article scope...
    count(/data/groups/group[@id = ./group/@id]) &gt; 0

    correctly I should use something like IN operator, because I'm
    comparing ID with group of attributes, it means
    count(/data/groups/group[@id in ./group/@id]) &gt; 0

    .... but XSLT doesn't have this kind of operator... well, do you have
    any idea to solve that?

    Thanks a lot!

    osup
     
    oSup, Mar 9, 2005
    #1
    1. Advertising

  2. oSup

    Joris Gillis Guest

    Tempore 14:14:45, die Wednesday 09 March 2005 AD, hinc in foro {comp.text.xml} scripsit oSup <>:

    > ... i'm in /data/articles/article scope...
    > count(/data/groups/group[@id = ./group/@id]) &gt; 0
    >
    > correctly I should use something like IN operator, because I'm
    > comparing ID with group of attributes, it means
    > count(/data/groups/group[@id in ./group/@id]) &gt; 0
    >

    Hi,

    I don't think this problem has to do with some IN operator functionnality.

    The context node changes inside a predicate, so replace '.' (=the context node) with 'current()' (=the current node)

    count(/data/groups/group[@id = current()/group/@id]) &gt; 0

    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
    Fiat W3C in tenebris
     
    Joris Gillis, Mar 9, 2005
    #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. ALuPin

    PLL phase after compensation

    ALuPin, Jul 19, 2004, in forum: VHDL
    Replies:
    2
    Views:
    1,817
    ALuPin
    Jul 20, 2004
  2. Balu
    Replies:
    1
    Views:
    434
    Juan T. Llibre
    Feb 24, 2006
  3. Balu
    Replies:
    1
    Views:
    361
    darrel
    Feb 25, 2006
  4. VHDL_HELP

    help for motion compensation

    VHDL_HELP, Feb 24, 2007, in forum: VHDL
    Replies:
    1
    Views:
    436
    weber
    Feb 24, 2007
  5. metaB
    Replies:
    2
    Views:
    180
    metaB
    Aug 9, 2012
Loading...

Share This Page